jacob navia said:
Daniel Rudy a écrit :
This is nonsense.
// comments are standard C!!!
Yes, they are supported by the latest C standard. Daniel's
implication that they're specific to C++ is incorrect.
But then, designated specifiers and variable argument macros are also
supported by the latest C standard, and you've recently stated that
lcc-win32 doesn't support those features.
Very few implementations support all of C99. Most current compilers
support all of C90 (apart from the inevitable bug here and there) in
some mode. And most current compilers support "//" in some mode (a
mode that does not fully conform either to C90 or to C99).
Let's say I want to write code that is purely C90 except for the use
of "//" comments. A compiler that supports "//" comments will usually
support some other C99-specific features as well, and will not warn
about attempts to use those features. But the subset of C99-specific
features varies from one compiler to another, making it quite
difficult to write portable code *unless* I ask the compiler to
diagnose *all* attempts to use C99-specific features.
For example, let's say I write the following program:
#include <stdio.h>
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
int main(void)
{
int x = 42;
// The following line uses a C99-specific feature.
DEBUG("Diagnostic: x = %d\n", x);
return 0;
}
I compile it with gcc, using a mode in which it doesn't complain about
the "//" comment. In such a mode, it doesn't complain about the
variadic macro either (and maybe I didn't realize that that's a
C99-specific feature).
Since gcc didn't complain, I assume that the code is portable, so I
try to compile it with lcc-win32. lcc-win32, of course, happily
accepts the "//" comment, but ... well, I don't have a copy of
lcc-win32, so maybe you can tell us what happens.
One compiler might not support variadic macros. Another might not
properly support variable-length arrays. Since there are few
conforming C99 compilers, and none in widespread use, those of us who
want to write portable code are forced to program in a *subset* of
C99. And, as it turns out, the only subset that currently can be
*enforced* (i.e., we can expect compilers to warn us when we violate
it) looks very much like C90.
jacob, based on your past history, I'd be pleasantly surprised if you
understood this (the same points have been made before), but perhaps
it will be instructive for others.