←back to thread

GCC 15.1

(gcc.gnu.org)
270 points jrepinc | 6 comments | | HN request time: 0s | source | bottom
Show context
Calavar ◴[] No.43792948[source]
> {0} initializer in C or C++ for unions no longer guarantees clearing of the whole union (except for static storage duration initialization), it just initializes the first union member to zero. If initialization of the whole union including padding bits is desirable, use {} (valid in C23 or C++) or use -fzero-init-padding-bits=unions option to restore old GCC behavior.

This is going to silently break so much existing code, especially union based type punning in C code. {0} used to guarantee full zeroing and {} did not, and step by step we've flipped the situation to the reverse. The only sensible thing, in terms of not breaking old code, would be to have both {0} and {} zero initialize the whole union.

I'm sure this change was discussed in depth on the mailing list, but it's absolutely mind boggling to me

replies(14): >>43793036 #>>43793080 #>>43793121 #>>43793150 #>>43793166 #>>43794045 #>>43794558 #>>43796460 #>>43798312 #>>43798826 #>>43800132 #>>43800234 #>>43800932 #>>43800975 #
VyseofArcadia ◴[] No.43793036[source]
I feel like once a language is standardized (or reaches 1.0), that's it. You're done. No more changes. You wanna make improvements? Try out some new ideas? Fine, do that in a new language.

I can deal with the footguns if they aren't cheekily mutating over the years. I feel like in C++ especially we barely have the time to come to terms with the unintended consequences of the previous language revision before the next one drops a whole new load of them on us.

replies(7): >>43793065 #>>43793137 #>>43793145 #>>43793417 #>>43793448 #>>43793509 #>>43793850 #
pjmlp ◴[] No.43793448[source]
Programming languages are products, that is like saying you want to keep using vi 1.0.

Maybe C should have stop at K&R C from UNIX V6, at least that would have spared the world in having it being adopted outside UNIX.

replies(2): >>43793673 #>>43794562 #
ryao ◴[] No.43794562[source]
If C++ had never been invented, that might have been the case.
replies(1): >>43795609 #
1. pjmlp ◴[] No.43795609[source]
C++ was invented exactly because Bjarne Stroustoup vouched never again to repeat the downgrade of his development experience from Simula to BCPL.

When faced with writing a distributed systems application at Bell Labs, and having to deal with C, the very first step was to create C with Classes.

Also had C++ not been invented, or C gone into an history footnote, so what, there would be other programming languages to chose from.

Lets not put programming languages into some kind of worshiping sanctuary.

replies(1): >>43801764 #
2. uecker ◴[] No.43801764[source]
I don't think C would have become a footnote if not for C++ given UNIX.
replies(1): >>43802104 #
3. pjmlp ◴[] No.43802104[source]
Most likely C++ would not happened, while at the same time C and UNIX adoption would never gotten big enough to be relevant outside Bell Labs.

Which then again, isn't that much of a deal, industry would have steered into other programming languages and operating systems.

Overall that would be a much preferable alternative timeline, assuming security would be taken more seriously, as it has taken 45 years since C.A.R Hoare Turing award speech and Morris worm, and only after companies and government started to feel the monetary pain of their decisions.

replies(1): >>43804227 #
4. uecker ◴[] No.43804227{3}[source]
I think there are very good reasons why C and UNIX were successful and are still around as foundational technologies. Nor do I think C or UNIX legacy are the real problem we have with security. Instead, complexity is the problem.
replies(1): >>43805210 #
5. pjmlp ◴[] No.43805210{4}[source]
Starting by being available for free with source code tapes, and a commented source code book.

History would certainly have taken a different path when AT&T was allowed to profit from Bell Labs work, as their attempts to later regain control from UNIX prove.

Unfortunately that seems the majority opinion on WG14, only changed thanks to government and industry pressure.

replies(1): >>43805996 #
6. uecker ◴[] No.43805996{5}[source]
Being free was important and history could have taken many paths, but this does not explain why it is still important today and has not been replaced despite many alternatives. WG14 consists mostly of industry representatives.