Next: , Previous: , Up: Built-in functions   [Contents][Index]


7.2.3.46 $P: The C preprocessor symbol

$P is (essentially) a synonym for ‘$UNQUOTE("#")’ (see $UNQUOTE). It is useful for constructing FWEB macro definitions that expand to C preprocessor statements. For example,

@m CHECK(flag)
        $P if(flag)
                special code;
        $P endif

Another version of the preprocessor symbol is $PP (see $PP). For most purposes, $P and $PP will behave in exactly the same way. The difference between them is that $P is treated as a string (without surrounding quotes), whereas $PP is treated as a character. The character nature of $PP is used by FORTRAN to reset the column number to 1, so C-like preprocessor commands appear there rather than in column 7.

For further discussion of strings and the differences between $P and $PP, see Strings and quotes.