| ▲ | Sharlin 3 hours ago | |
`spriteframe_t` is defined as
which is okay to splat with all-ones as long as `boolean` is either a typedef for a fundamental type(*) or an enum – because C enums are just ints in a trenchcoat and have no forbidden bit patterns! The C99 `bool`/`_Bool` is, AFAICS, the first type in C that has fewer values than possible bit patterns.So yeah, on C99 and C++ this always had UB and could've broken at any time – though I presume compiler devs were not particularly eager to make it ill-behaved just because. But in pre-C99 it's entirely fine, and `rotate == true || rotate == false` could easily be false without UB. --- (*) other than `char` for which setting the MSB is… not UB but also not the best idea in general. | ||
| ▲ | zozbot234 21 minutes ago | parent [-] | |
C99 does not use bool unless you explicitly include stdbool.h, which won't be in any pre-C99 code. | ||