Hi,

how is the correct syntax for macros having more than one parameter?

  {$define HOFFSET(rec,field):=(pointer(@(rec).(field)) - pointer(@(rec)))}

This does not work, even if there is a semicolon between the two
parameter names.

Trying to use it like this:

  i := HOFFSET(s1, a); { Line 42 }


The compiler says:

$ fpc offsetof
Free Pascal Compiler version 2.0.2 [2005/11/17] for i386
Copyright (c) 1993-2005 by Florian Klaempfl
Target OS: FreeBSD/ELF for i386
Compiling offsetof.pas
offsetof.pas(42,7) Error: Identifier not found "HOFFSET"
offsetof.pas(42,19) Error: Identifier not found "a"


How should this be written?

TIA,
Marc


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

Reply via email to