@kitten_tech @halcy And CHAR_BIT != 8 and sizeof(void*) != sizeof(long), of course… All of this does exist somewhere, but AFAIK nobody has done all this in one system.
If you want to get real fancy, make an implementation for Setun (a ternary computer):
https://en.wikipedia.org/wiki/Setun
@halcy Like when Clang goes "I'mma optimize this null check away because spec says I can assume all uses are non-null, and you accidentally 'used' it three lines earlier"?
Personally I'd go for the "chaos compiler" where whenever something is left to the implementation it just picks a random behavior, including intentionally doing something absolutely nonsensical if the given input results in undefined behavior (it's not against spec for a compiler to insert bounds-checks if it knows the size of the array for certain... it's just that C's ABI makes it next to impossible for the compiler to know it)
@halcy
You could fsck a lot of code over by making `sizeof (int) == 2`
That was a lot of fun on the Amiga (SAS vs. Manx compilers). To this day, I still think carefully before using `int`.
@halcy gcc 1.34 interpreted #pragma as "play hack or rogue"
There are some good real world ones - pointer operations that can fault if the pointer is not valid, ones complement, twos complement but overflows cause an exception. For pre ANSI C the Honeywell L66 was fun. One config was 5 7bit chars and a spare bit per machine word, which sure made "sizeof()" interesting
When gcc first started using all the pointer aliasing opportunities that also created mayhem.