4 ms·
the problem is that the compiler assumes undefined behaviour can never happen ALL the time. Signed integer overflow is the most common one, since it means you
by octo_t 11y ago
the problem is that the compiler assumes undefined behaviour can never happen ALL the time.
Signed integer overflow is the most common one, since it means you can hoist 32bit ints into 64bit ints so they fit in one register or similar and save hitting the stack.
- deleted 11y ago[deleted]
- derefr 11y agoI'd personally be fine with being forced to specify what sort of undefined behaviors I want to allow to be "assumed I didn't mean"; it's not a problem for me if some code refuses to compile until I e.g. type-annotate my u32s with "they're not going to overflow, don't worry." I was about to say that "this would break a ton of other projects"—but actually, it seems like it'd be fine as long as it was an opt-in -W switch.