[fpc-devel] comparing methods

Martin Schreiber fpmse at bluewin.ch
Sat Sep 12 09:33:11 CEST 2009


On Thursday 10 September 2009 19:42:22 Ivo Steinmann wrote:
> Florian Klaempfl schrieb:
> > Ivo Steinmann schrieb:
> >> 1. Using =nil or Assigned should result in the same.
> >
> > Afaik not, this was one of the reasons for assigned.
> >
>
> well, nobody seems to know it...  eg. if you go through code in rtl
> (classes, etc...) sometimes =nil is used, sometimes Assigned. it's a
> complete random mix. I don't think that this "mix" was intention.

IDE's (Delphi, MSEide, don't know about Lazarus) store a method index number 
in TMethod.Code in published method properties because there is no code for 
the handler available at designtime, TMethod.Data is nil.
For designtime running software (RTL, FCL, components...)  *always* use 
assigned() in order to check if a method property is set before calling the 
handler or you will call the the indexnumber which probably want work 
well. ;-)
This is probably the reason using =nil or assigned() depending on the task in 
Classes.

Martin



More information about the fpc-devel mailing list