[fpc-devel] comparing methods

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Sep 12 10:07:55 CEST 2009


On Sat, 12 Sep 2009 09:33:11 +0200
Martin Schreiber <fpmse at bluewin.ch> wrote:

> 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, I hope you mean Data=ID and Code=nil.

Delphi and Lazarus uses this and Assigned and <>nil check only
Code, not Data. If MSEgui allows to use components from the FCL, then it
should leave Code=nil.


Mattias



More information about the fpc-devel mailing list