3 ms·
I'm very sure that's just UB. The standard requires unique representations of true and false (e.g. byte values of 1 and 0, but for all you care it could be 13 a
by MauranKilom 4y ago
I'm very sure that's just UB. The standard requires unique representations of true and false (e.g. byte values of 1 and 0, but for all you care it could be 13 and 37). Converting an integer to bool (even implicitly, as in `if (3)`) is required to lead to those values in the abstract machine.
If you somehow force a bool to be a different value (e.g. `*(int*)(&myBool) = 7`), that's UB.