Path: ...!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: David Brown Newsgroups: comp.lang.c Subject: Re: Is it possible to generate a compile time error from an inline function? Date: Sun, 14 Jul 2024 22:50:38 +0200 Organization: A noiseless patient Spider Lines: 35 Message-ID: References: <878qy3ss59.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 14 Jul 2024 22:50:39 +0200 (CEST) Injection-Info: dont-email.me; posting-host="3132360bab10f3edba3518866baa2112"; logging-data="334428"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+eGKOmzv3nKdzNknicVDt5oyQz0dvf8q0=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:L1lz9R1mgzriOKGOkxEFVs0Klio= Content-Language: en-GB In-Reply-To: <878qy3ss59.fsf@nosuchdomain.example.com> Bytes: 2740 On 14/07/2024 21:14, Keith Thompson wrote: > David Brown writes: >> On 13/07/2024 20:07, Richard Damon wrote: > [...] >>> The question being since most C compilers are also C++ compilers, >>> they somethings accept this sort of C++ism as an extension. >> >> Actually, the vast majority of C compilers are /not/ also C++ >> compilers. But the most popular C compilers, by a significant >> margin, are C++ compilers. > > I wouldn't quite put it that way. > > gcc, clang, and Microsoft provide both C and C++ compilers, but they're > separate applications, perhaps invoked from a common driver program. > They typically share the same backend, but the frontends are separate. > I wouldn't expect to see any code that parses "int class;" and decides > whether it's a syntax error based on which language is being compiled. > > The C and C++ frontends might share some code, but they're separate > applications. > That is a lot more accurate than the way I described it. However, it is the case that the C compilers have historically picked up features from their sibling C++ compilers as extensions. They don't get things that are directly counter to the way C works, and the good features have often made it into later C standards. So yes, separate applications but with some code sharing is a better way to put it.