[fpc-devel] Declare variables inside the code

Jonas Maebe jonas.maebe at elis.ugent.be
Thu May 12 10:21:23 CEST 2011

On 12 May 2011, at 09:32, Michael Schnell wrote:

> On 05/11/2011 06:48 PM, Joerg Schuelke wrote:
>> I would introduce a macro expansion trough a compiler directive.
> What a bout a compiler directive to optionally call the gnu C  
> preprocessor ? I would have wanted used this some time ago for a  
> very special project.

You cannot use cpp, because it cannot deal with Pascal comments (as a  
result it sometimes interprets text inside Pascal comments as the  
start of a C-style comment, and removes all of the source code coming  
after it).

gpc -E works better, but
a) it adds "# 1 file.xxx" pseudo-statements that indicate which source  
file starts at that point (cpp inserts the same ones, so using that  
one instead would not help)
b) it inlines the constents of {$include xxx} statements (so the  
compiler-inserted debug information would no longer be correct, unless  
you teach it to parse those "# 1 file.xxx" statements), and  
furthermore also leaves the original {$include xxx} statement in the  
source (so the compiler would process it twice)

I don't think it would be a problem to add support for calling an  
external preprocessor if someone would write one though.


More information about the fpc-devel mailing list