Is there a way to use another char than #
when defining preprocessor directives? Example:
Instead of:
#if 1
foo
#endif
Use ?
, for example:
?if 1
foo
?endif
Is there a way to use another char than #
when defining preprocessor directives? Example:
Instead of:
#if 1
foo
#endif
Use ?
, for example:
?if 1
foo
?endif
You have two options:
??=if 1
%:if 1
Both of these are 100% standard C, but at the same time considered very bad practice. However, mainstream compilers tend to warn against trigraphs but not for digraphs, so digraphs are perhaps the lesser evil.
There are trigraph sequences that exists to replace certain characters. In particular, the #
character can be replaced with ??=
. So the following code is valid:
??=if 1
foo
??=endif
You can't however put an arbitrary replacement in place.