>> In Delphi, the line
>>
>>         @UserDataEvent := pointer(FUserDataHandlers[I]);
>>
>> is common practice. What is the difference to FPC and the appropriate
>> workaround?

Forgive me for jumping in without reading the whole thread (Webmail is a
real PITA for this) but; No that is not completely correct. It does depend
on what you are doing. In Delphi, the _usual_ way to assign a method
pointer is as follows:

type TMyMethodPointer = procedure (const s; string) of object;

var
  mp: TMyMethodPointer;

...
  mp := AnInstance.CompatibleMethod;
...

However, for function pointers:

type TMyFuncPointer = procedure (const s; string);

var
  fp: TMyFuncPointer;

...
  fp := @CompatibleFunc;
...

The double dereference the poster uses above is not necessary. If
anything, the fact it works in Delphi is questionable.

M



_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to