Rust and GCC, two different ways
Rust and GCC, two different ways
Posted Oct 11, 2021 10:08 UTC (Mon) by Wol (subscriber, #4433)In reply to: Rust and GCC, two different ways by eru
Parent article: Rust and GCC, two different ways
For example, is the size of a byte defined? It wasn't always 8 bits. The spec should be "the most convenient size for the processor to store a Western character. A minimum of 6 so the Roman Alphabet and numbers fit, a maximum of 11 so no two compilers can argue how many bits in a byte". Obviously, modern x86 architecture that's 8 bits. ICL I believe was 6. Some other architectures were 9 iirc. But the point is, you can then pretty much guarantee any compiler on a specific hardware is going to agree.
Or you offload the default decision onto the compiler - "the compiler must implement any sane understanding consistently". No guarantees that different compilers do the same thing, but it's a breach of the spec for compilers to change their implementation without warning.
The quicker C (and C++?) ditch the concept of "undefined behaviour" - even if they just replace it with "defined elsewhere" - the better.
Cheers,
Wol
