Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: "A diagram of C23 basic types" Date: Fri, 04 Apr 2025 12:18:58 -0700 Organization: None to speak of Lines: 36 Message-ID: <85zfgvivkt.fsf@nosuchdomain.example.com> References: <87y0wjaysg.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Injection-Date: Fri, 04 Apr 2025 21:18:59 +0200 (CEST) Injection-Info: dont-email.me; posting-host="67f759117d835bc43485294cec1b3a9d"; logging-data="210449"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19uNDa1GxWVJ8K59PmCfLg0" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:YizNqmw2P69Dpd/ZEMDf3grWpKE= sha1:g8Sh3TZlObq0KA0hs/kFhaH1BUU= Bytes: 2701 David Brown writes: [...] > It is easy to write code that is valid C23, using a new feature copied > from C++, but which is not valid C++ : > > constexpr size_t N = sizeof(int); > int * p = malloc(N); It's much easier than that. 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's time. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com void Void(void) { Void(); } /* The recursive call of the void */