Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-01

procedure variable and inc/dec procedures

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

ik

Hello,

I'm trying to do the following:

---------
var
  a : procedure(var x : TOrdinal);
  b : procedure(var x : integer);
begin
  a := @inc;
  b := @dec;
end.
-----------

I simplified the original code of mine to this specific example to make it more clear.

At variable a, I get the following error
Error: Identifier not found "TOrdinal"

And on both of them I get:
Fatal: Syntax error, "(" expected but ";" found

This does not happen on my own procedures, or other procedures at all that I have tried.
Why doesn't the compiler like the above code ?
What is the difference between that and other procedures ? And beside inline wrapper, is there a way to do this like so ?

Thanks,
Ido

Reply by email

Howard Page-Clark
to ik
ik wrote 9 lines
var a : procedure(var x : TOrdinal); b : procedure(var x : integer); begin a := @inc; b := @dec; Why doesn't the compiler like the above code ?

Inc and Dec are internal compiler routines, more like macros than true functions. They are not coded as library functions you can locate in the RTL at an addressable location.

Reply by email