A while ago I have discovered an (rather ancient) C Compiler, which scanned macros this way (Pseudo code):
if line.startswith("#include") or line.startswith("#define"):
...
.. Which kind of raised the question for me where macros should really be placed, at the beginning of a line, like so:
void stuff()
{
#if defined(WIN32) || defined(_WIN32)
...
#else
#if defined(__GNUC__)
...
#else
...
#endif
#endif
}
Or rather like so (as that's the way I do it, for improved readability):
void stuff()
{
#if defined(WIN32) || defined(_WIN32)
...
#else
# if defined(__GNUC__)
...
# else
...
# endif
#endif
}
Is the way one indents the Preprocessor code standardized, that is, no matter how i indent it, it will always work the same way?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…