Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Bo Persson Newsgroups: comp.lang.c++ Subject: Re: To C or not to C++ Date: Mon, 15 Aug 2022 22:22:13 +0200 Lines: 21 Message-ID: References: <2868500762@darkrealms.ca> <87iln0owgr.fsf@nosuchdomain.example.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net WZE/ysE3Og2UBrRkdZ5MOAhDhABo62z1AKwzww3stj29Z9I8um Cancel-Lock: sha1:PEpPh98CfUfPb/fHwb1U3j34VlE= User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Content-Language: sv In-Reply-To: Xref: csiph.com comp.lang.c++:85946 On 2022-08-15 at 21:01, Muttley@dastardlyhq.com wrote: > On Mon, 15 Aug 2022 06:16:23 -0000 (UTC) > Juha Nieminen wrote: >> Muttley@dastardlyhq.com wrote: >>> Rubbish. I've got multi thousand line originally C programs which I've >> happily >>> compiled with C++ compilers in C++ mode due to a few minor C++ additions. >> >> I assume it's C89. Modern C is more unlikely to be compilable as C++ as-is >> (for example because of out-of-order designated initializers, 'restrict', >> and so on). Even some completely standard-legal C89 won't compile as C++, >> such as: >> >> char *str = "hello"; >> >> (which is 100% valid standard C, but not valid C++.) > > Both clang and gcc will compile it but with a warning. > And the warning says that it *is* valid?!