News for hackers. Stuff that matters.
Re:Learning that you can use unions in C for grouping things... by midjji on Sunday August 01, 2021 @04:52PM (#28029846)
There is absolutely undefined behaviour there. Undefined behaviour is defined not as nasal daemons but as: The compiler implementer does not guarantee that this behaviour will be hardware, circumstance, compiler version, or os consistent, nor that we will warn if we change this.

Packed is technically not a undefined behaviour, but it is certainly a trap. Especially because the compiler macros leads people to make defines which select packed by compiler automatically. Then the special case of didn't recognize compiler is just left empty, meaning compiles but no longer does what you think.

Re:Learning that you can use unions in C for grouping things... by fifjdynb on Sunday August 01, 2021 @05:35PM (#28030239)
You don't get to decide what UB means. It really does mean nasal demons are a possibility: all bets are off when you run that executable. Use of the term "undefined behaviour" to mean something else may be on the increase, unfortunately (https://mars.nasa.gov/technology/helicopter/status/298/what-...), but if we're talking about C, it's meaning is fixed.
Re:Learning that you can use unions in C for grouping things... by midjji on Monday August 02, 2021 @03:29PM (#28041501)
I didnt, the deterministic nature of computer programs guarantees that what I wrote is the actual outcome.