_cbsz
Joined 17 years ago
Joined 17 years ago
If you don't set the underlying type, assigning a value that doesn't match an enumerator via `static_cast` is undefined behavior. See https://en.cppreference.com/w/cpp/language/enum . (Doing weird pointer casting things is also undefined behavior per the strict aliasing rule, though, come to think of it, I'm not sure whether memcpying an out-of-range value into an enum through the "reinterpret_cast to `char*`" loophole is undefined behavior.)
There was a port to the original Xbox, which had only 64 MB of RAM!
The article links out to Compiler Explorer (https://godbolt.org/), which shows the exact compiler version and options and lets you play with different ones. It shouldn’t matter which compiler — the standard prohibits optimizing this.
I didn’t write it, I just copied the compiler output from Godbolt so that the article could be read on mobile, where Godbolt’s UI doesn’t work so well and switching tabs back and forth is difficult.
Are you talking about ARM64 or ARMv7?
TIL! I went and dug up a citation: https://blog.reverberate.org/2013/08/parsing-c-is-literally-...