[fpc-devel] {$I %LINE%} and friends
michael.vancanneyt at wisa.be
michael.vancanneyt at wisa.be
Fri Apr 29 09:32:42 CEST 2011
On Fri, 29 Apr 2011, Joerg Schuelke wrote:
> There is one problem with {$I %LINE%} and his friends, which restricts
> the use of these directives. They are expanded even inside a macro
> immediately, so, if you define a macro for debugging purposes, you
> get the line and file info for the place of the definition and not
> for the place of the expansion.
>
> I am playing around with the compiler for some weeks, maybe i will send
> a patch ( in a couple of weeks, the code is somehow complicated ) if
> desired.
>
> But what is the cleaner way? To defer the expansion of {$I %xxx%}
> inside macros, or to define c-like macros __LINE__ and __FILE__, maybe
> with nicer names?
Defer expansion.
The use of {$I } is mandatory, since __LINE__ and friends are valid
pascal identifiers and this should not be changed by a macro.
Michael.
More information about the fpc-devel
mailing list