[fpc-pascal] macros with more than one parameter
Marc Santhoff
M.Santhoff at t-online.de
Wed Sep 20 01:31:56 CEST 2006
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
More information about the fpc-pascal
mailing list