[Lazarus] Weird object variables access [SOLVED] - Delphi mode bug!
nc-gaertnma at netcologne.de
Wed Oct 25 13:41:43 CEST 2017
On Wed, 25 Oct 2017 13:05:57 +0200
Giuliano Colla via Lazarus <lazarus at lists.lazarus-ide.org> wrote:
> With older Delphi's up to, I believe, Delphi 7 you have that:
> 1) the syntax for the assignment of a procedural type is @ProcIdentifier
> := whatever;
No. The Delphi syntax is "ProcIdentifier:=Proc" or
The "@Some:=" means assign something to address of Some. Which is bogus.
I guess Delphi's auto dereference actually translates this to
@Some^:=. Still bogus, but valid bogus.
> 2) If whatever is a pointer, and ProcIdentifier is a Method, the data
> field is left untouched
> This made it possible, with some dirty tricks to build a proper method
> procedural type.
> In recent Delphi's (someone tested with X7, I did with X10)
> 1) The syntax @ProcIdentifier := whatever is no more valid. It's no more
> possible to assign a pointer to a method type without typecasting.
> 2) Assigning (with typecasting) a pointer to a method type will set the
> data field to Nil.
> This makes it impossible to use dirty tricks.
Huh? Delphi allows to typecast almost anything. At least it warns.
> Currently fpc in Delphi mode accepts the old syntax, but sets the data
> field to Nil, thus creating a misleading inconsistency.
More information about the Lazarus