2 ms·
Almost all optimisations in C/C++ compilers depend on undefined behaviour, because practically no behaviour is defined! The trick is to define behaviour, which
by jiggawatts 3y ago
Almost all optimisations in C/C++ compilers depend on undefined behaviour, because practically no behaviour is defined!
The trick is to define behaviour, which is what other programming languages do.
E.g.: in both C# and Rust, integers have fixed sizes. A C# Int32 is equivalent to a Rust i32. Only God knows what a C/C++ "int" is. It could have 17 bits and use ternary.
- jules 3y agoAs I said, this isn't about ints, it's about pointers. What behavior will you define in C for writing to a random memory address?