krackers 14 hours ago

I don't understand why newer revisions of C don't work on fixing these small issues. Things that were previously "undefined/implementation-defined behavior" can easily be made to behave sensibly without breaking anything. Type punning, 2s complement overflow, 0-initializtion of unions, all of those should "just behave" sensibly how the programmer expects. And you can already get there with the right compiler flags, so why not just codify it. It's also not going to break anything since it was undefined behavior in the first place.

1
darthwalsh 9 hours ago

C still supports a huge variety of embedded processors, which I imagine influences the overflow UB. But clearing up the type semantics would be nice.

krackers 9 hours ago

Are there any processors today which _don't_ use 2s complement?

Gibbon1 6 hours ago

I use embedded processors. I don't know of any that don't use 2s complement. There are only a handful of increasingly irreverent processors that are big endian. And x86 real mode processors are long in the tooth.

There other thing is the ratio of processing power vs memory size is very high for embedded machines. You have processors that can hold their own against a 486 but only have 16k of RAM. And the marginal cost of performance is low. A lot of devices spend most of their time doing utterly nothing.