Liste des Groupes | Revenir à cl c |
David Brown <david.brown@hesbynett.no> writes:Mr. Flibble's universal compiler? :-)
[...]It is easy to write code that is valid C23, using a new feature copiedIt's much easier than that.
from C++, but which is not valid C++ :
>
constexpr size_t N = sizeof(int);
int * p = malloc(N);
int class;
Every C compiler will accept that. Every C++ compiler will reject
it. (I think the standard only requires a diagnostic, which can
be non-fatal, but I'd be surprised to see a C or C++ compiler that
generates an object file after encountering a syntax error).
Muttley seems to think that because, for example, "gcc -c foo.c"
will compile C code and "gcc -c foo.cpp" will compile C++ code,
the C and C++ compilers are the same compiler. In fact they're
distinct frontends with shared backend code, invoked differently
based on the source file suffix. (And "g++" is recommended for C++
code, but let's not get into that.)
For the same compiler to compile both C and C++, assuming you don't
unreasonably stretch the meaning of "same compiler", you'd have to
have a parser that conditionally recognizes "class" as a keyword or
as an identifier, among a huge number of other differences between
the two grammars. As far as I know, nobody does that.
You and I know he's wrong. Arguing with him is a waste of everyone'sYes, it seems that way. Sometimes he makes posts that are worth answering or correcting, but the threads with him inevitably go downhill.
time.
Les messages affichés proviennent d'usenet.