2015-10-10 21:12 GMT+02:00 Sven Barth <pascaldra...@googlemail.com>:

>
> "@@" (though I have to admit that I don't know where you got that @@ from;
> was that introduced in Delphi recently?)).
>
> It's not an easy topic and I'd really welcome the input of other core
> developers...
>

Somehow I forgot to answer...

@@ is old syntax (maybe even from TP?). @@ is used to get pointer to
variable which holds pointer to procedure/function.

=== begin code ===
procedure foo; begin end;

var
  p: procedure;
  pp: pointer;
begin
  Assert(@p = nil);
  Assert(addr(p) = nil);
  pp := @@p;
  Assert(pp <> nil);
  p := @foo;
  Assert(@p = @foo);
  Assert(addr(p) = addr(foo));
  Assert(pp = @@p);
end.
=== end code ===

another way to get pointer to that kind of variable instead of @@ is:

=== begin code ===
function getptr(var x): pointer;
begin
  Result := @x;
end;
var
  p: procedure;
  pp: pointer;
begin
  pp := getptr(p);
=== end code ===
-- 
Best regards,
Maciej Izak
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to