News for hackers. Stuff that matters.
Re:New C features in GCC 13 by lou1306 on Thursday May 04, 2023 @08:24AM (#35814190)
Maybe. But by reading the article one does get the impression that GCC devs (and C2X proposal authors) really like C++: the language is mentioned 16 times, and easily half of the features are lifted more or less as-is from there.
Re:New C features in GCC 13 by seba_dos1 on Thursday May 04, 2023 @09:17AM (#35814796)
As a C programmer, it just seems like they finally took the minority of ideas added by C++ that were actually good ideas and added them back to C. Aside of `auto` which I'm ambivalent about (I think the only place where it's useful are macros) those all make perfect sense in context of C and I believe the only reason for C++ having them first is that C++ simply evolved faster.
Re:New C features in GCC 13 by klodolph on Thursday May 04, 2023 @09:47AM (#35815256)
It makes a lot of sense for the languages to be harmonized with each other. Differences like noreturn versus [[noreturn]] does nobody any favors. C++ has all these wacky things you can do with constexpr functions, and C is getting a VERY LIMITED version of this that only applies to constants, addressing a long-standing deficiency, where C provides only a way to define named constants as int type (using enum) or using macros, and you really want to be able to define constants as any type you like. The "const" qualifier doesn't do that, you see... it really means a couple different things, but the main one is "read-only", which is not the same as "constant".
Re:New C features in GCC 13 by steveklabnik on Thursday May 04, 2023 @01:22PM (#35818962)
One of the benefits, historically, to both languages is that they share a very large chunk of the language in common. It's therefore in their common interest to try and maintain that common subset wherever possible. The goal here (just to be clear, from my outside perspective) isn't to unify the languages, it's to ensure that stuff that's the same stays roughly the same. If the same code produces two different things, based on the language, that's unfortunate. Code that works in one but doesn't compile in the other is totally fine, of course.