Wed, 18 Jun 1902 08:00:00 GMT
Advanced: Free doesn't assign Nil?
Edward, Free simply wraps to a destroy call with a single check to see if the pointer is nil. I suppose you'll have to ask Borland why they implement there objects the way they do. Personally I am content with the way they handle their pointers. Say you have an object reference declared in a var section (on the stack) your reference variable contains whatever garbage happens to be on the stack. You have to initialize the pointer to nil under certain operations. i.e. tBookMark. I don't see any difference here. At another level freemem and dispose do not set pointers to nil, whereas realoc does. Garry Kernan QuoteEdward Garson wrote: > Greetings, > I recently tried to 'free' a (created) object twice in a short > experimental program. Two subsequent calls to Free for a created object > results in an access violation. If I free the object, and then assigned nil > to the object (pointer), then no access violation occurred. My question is, > why doesn't Delphi assign nil to an object after freeing it? > Regards > Edward Garson > Flairbase Inc. > edward@NO_SPAMshuya.ml.org
|