On Mon, 2007-04-16 at 09:02 +0200, Mattias Gaertner wrote:
> On Mon, 16 Apr 2007 08:49:53 +0200
> Mattias Gaertner <[EMAIL PROTECTED]> wrote:
> > 
> > The trick itself is easy:
> > TMethod contains two pointers: code (the address) and data (the
> > TObject). Normally you assign both and everything works normally. But
> > if you set only one of them nil, then the test "AMethod<>nil"
> > still is true, but "Assigned(AMethod)" gives false.
> > If all components always use "if Assigned(AMethod) then AMethod(...)",
> > then this trick prevents calling the method at designtime, while still
> > holding a pointer. The pointer can be used by the IDE to know, which
> > method name to stream. 
> > I don't remember which of the pointers are set to nil by Delphi.
> > A quick test revealed: FPC's Assigned does not support this.
> 
> On a second test: FPC works great. The <>nil works just the same as
> Assigned, which is IMHO even better. We can store a pointer in "data"
> and keep "code" nil.

A sidenote to the fpc-developers. Is this 'by design' so that it won't
change in the future. And if it's by design, it's maybe a good idea to
add a test for this, since it would be a problem if this is changed, and
no-one understands why Lazarus keeps crashing. ;)

Joost.

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to