3 ms·
UB is blown out of proportion by compiler vendors and language-lawyer types concerned with portability across exotic ranges of machines, including those, where,
by bluetomcat 6y ago
UB is blown out of proportion by compiler vendors and language-lawyer types concerned with portability across exotic ranges of machines, including those, where, for example, CHAR_BIT != 8.
For the most part, avoiding UB is common sense when you grasp the basic abstract C memory model - types of storage and their lifetime, avoiding out of bounds array access, keeping track of the lifetime of all allocations, etc.
- srtjstjsj 6y agoThat's not the issue. The issue that simple bugs become global program transformations into nonsense due to aggressive optimizations, when they should instead be compile-time errors.
- armitron 6y agoIt's actually a big problem and anything but common sense. Do all C programmers know what strict aliasing means? How about pointer provenance? Have they memorized integer promotion rules? These are all potential sources of undefined behavior that can lead to catastrophic results. I bet most experienced C programmers with decades under their belt would fail one or more of these tests.