3 ms·
Unaligned access being fine in one architecture, but not in others would create separate dialects, regardless of being blessed by ISO C. Just don't do unaligne
by leni536 5mo ago
Unaligned access being fine in one architecture, but not in others would create separate dialects, regardless of being blessed by ISO C.
Just don't do unaligned access, it's a dialect that doesn't exist currently, and should never exist.
- eru 5mo ago> Unaligned access being fine in one architecture, but not in others would create separate dialects, regardless of being blessed by ISO C. That doesn't mean unaligned access would need to be UB. It could be implementation defined. Or could just be defined to result in an error on all machines.
- leni536 5mo agoImplementation-defined without further constraining the behavior is not much better than undefined. Defining it to always error would add overhead even for proper aligned access on x86, as the generated code would need to explicitly check in many cases.
- eru 5mo ago> Implementation-defined without further constraining the behavior is not much better than undefined. No, it's a lot better. Because implementations have to define it.