←back to thread

GCC 15.1

(gcc.gnu.org)
270 points jrepinc | 2 comments | | HN request time: 0.473s | source
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 #
1. hulitu ◴[] No.43793145[source]
It's careless development. Why think something in advance when you can fix it later. It works so well for Microsoft, Google and lately Apple. /s

The release cycle of a software speaks a lot about its quality. Move fast, break things has become the new development process.

replies(1): >>43802151 #
2. pasc1878 ◴[] No.43802151[source]
That does not make sense for anything that exists over decades.

Do you want to be still using Windows NT, or C++ pred 2004 standard or python 2.0

We learn more and need to add to things., Some things we designed 30 years ago were a mistake should we stick with them.

You can't design everything before release for much software. Games you can or bespoke software for a business as you can define what it does, but then the business changes.