[fpc-pascal] methods of an object to create others objects

Alberto Narduzzi albertonarduzzi at yahoo.com
Wed Jul 7 00:13:28 CEST 2010


Andrew Brunner wrote:
> It most certainly is not "safe".  LOL.  Free calls destroy.. Destroy
> may contain other frees and routines... You cannot guarantee that free
> will even return.

the point was to call .Free on an object that might not have been 
initialized, not what Free ( or destroy, for the matter) would 
eventually call _after_, so it _is_ safe.

I guess (well, I just don't remember exactly) Free is safe because it is 
a class method, hence it _can_ be called on a non initialized object; 
and therefore can test the object instance against Nil and act consequently.

Someone correct me if I'm wrong on this... ;-)


Cheers, A.




More information about the fpc-pascal mailing list