Re: On C99, C11, and other dialects
Matthias Andree via Mutt-dev <[email protected]>
| Newsgroups | gmane.mail.mutt.devel |
|---|---|
| Message-ID | <[email protected]> |
Am 18.04.26 um 01:06 schrieb Alejandro Colomar via Mutt-dev: > Yeah, that's a compound literal, which doesn't exist in C++, so this > can't be used in C++ mode. (This reminds me that I need to wrap the > musl code in !defined(__cplusplus).) That's a bad language; I recommend > not using it: if you want the good things from C++, you need to use > modern C++, which strays away from C too much. If you stay with the old > C++, what you get is some terrible dialect that doesn't get the benefits > of modern C nor of modern C++. My recommendation on C++ differs from Alex's, and I find it quite usable and used right fixes a shitload of type bugs that you cannot fix in C, not even with _Generic -- and it has its places. It "strays from C too much" isn't really true, the common subset between C11 and C++23 is near complete, but if you're bound to "C99 and no other standard because we have commercial compiler FOO for target BAR" and some other target platform prevents you from going to C++17, alignment specifiers (C99 lacks them) and designated initializers (C++20 and older lack them) are out. Sometimes your compiler extensions save the day, but also encourage writing other non-portable code, so that's difficult.