The preprocessor creates preprocessing markers, which are later converted to C-tokens.
In general, the conversion is quite direct, but not always. For example, if you have a conditional preprocessor directive that evaluates to false, as in
#if 0 comments #endif
then in comments you can write whatever you want, it will be converted to preprocessing tokens that will never be converted to C-tokens, so inside the C source file you can paste the code without comment.
The only connection between the preprocessor language and C is that many tokens are defined almost identically, but not always.
for example, it is permissible to have preprocessor numbers (in the ISO9899 standard, called pp numbers), for example 4MD , which are valid preprocessor numbers but not valid C numbers. Using the ## operator, you can get a valid C identifier using these preliminary numbers processing. for example
#define version 4A #define name TEST_ #define VERSION(x, y) x##y VERSION(name, version) <= this will be valid C identifier
The preprocessor was designed to be applicable to any language for translating text, not referring to C. In C, it is generally useful to make a clear separation between interfaces and implementations.
alinsoar
source share