I am trying to port some relatively modern C code to an older compiler.
This compiler (DICE), it seems, chokes on the first header file and the first occurrence of this idiom:
#ifndef SOMETHING
#define SOMETHING
...
#endif /* SOMETHING */
it dies on the second line in the header with:
DCPP: "../../code/someheader.h" L:2 C:0 Error:39 Syntax Error
Changing to #define SOMETHING 1
made no difference.
So I have really two questions, am I using DICE with the wrong option or something, or did C programmers use some other idiom equal to ifndef-define back in the old days?
References:
If it is this C compiler then by looking at the sources (src\dcpp\cpp.c) you can see that newlines only include the carriage return character and not the linefeed character.
If you have a line ending with CRLF then when the compiler strips the whitespace at the start of the line, it does not strip the linefeed before the #
which is a syntax error, since preprocessor directives starting with #
must be the first non-whitespace character in the line.
#if SOMETHING
#else
#endif
might just work everywhere
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With