[fpc-devel] Declare variables inside the code

Hans-Peter Diettrich DrDiettrich1 at aol.com
Wed May 11 13:12:22 CEST 2011


Michael Schnell schrieb:

> IMHO the reason is reusing the variable name, which in C can be 
> essential with complex macro declarations. You can reintroduce any 
> variable name in a {-} block without harming the variable with the same 
> name declared outside and used before and after the block .

ACK.

As the downside a macro can use variables without declarations, so that 
the coder is responsible for providing according declarations for every 
such macro expansion. That's also a frequently used feature, that can 
make C code even more unreadable.

As a midway variables can be passed to C macros, by name, what increases 
the compile time considerably. FPC macros don't have parameters, for 
this and other reasons. That's not a hard restriction, because inline 
procedures can be used instead, in many cases.

DoDi




More information about the fpc-devel mailing list