4 ms·
Insane that it’s this easy to cause undefined behavior. Forgot what size a “long long” is on your arch when writing a print statement? Undefined behavior.
by nynx 5y ago
Insane that it’s this easy to cause undefined behavior. Forgot what size a “long long” is on your arch when writing a print statement? Undefined behavior.
- tux3 5y agoMultiplying unsigned shorts is famously (?) undefined behavior on most platforms. They get promoted to int, and the result overflows. https://stackoverflow.com/questions/33732489/ https://stackoverflow.com/questions/33732489/
- vlovich123 5y agoThis seems like one of the more innocuous ones that’s automatically caught by compiler warnings. Admittedly projects have to turn that on and fix warnings (or build with errors) and not all do. The standard should really mandate that certain kind of warnings today should just be unconditional compiler errors.