Hariharan wrote:
Hi all,
I get the following warning from the GCC compiler (all versions that i
tried on after 4.2.x), but doesnt generate the warning with 4.1.1
compiler. I went through the C99 standard and couldnt find anything
relevent.
If i tried to compile
#if 0
The 'appostrophie character causes warnings in code that is #defed out
IFF it is unmatched
#endif
int main(void)
{
for(;;)
{
}
}
I get the following warning.
test.c:2:7: warning: missing terminating ' character
I am not exactly sure if this is buggy behaviour, but it obviously
isnt what i would have expected.
Please clarify if this is a bug.
The warning is actually from cpp not gcc.
tstdenis@photon:~$ cpp test.c
# 1 "test.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "test.c"
test.c:3:7: warning: missing terminating ' character
For reference I'm running gcc v4.3.2 (cpp as well).
Technically, warnings are not part of the C spec, so it's not a "bug" in
the sense the compiler is "wrong." I don't think it should change
though since "#if 0" is not a standard way of putting comments in code.
use a /* */ block instead. Typically #if 0 goes around code that you
want to temporarily remove from the unit.
Tom