| ▲ | flohofwoe 2 hours ago | |
> Because C is fundamentally defined for an abstract machine. This is more like a guideline than actual rule ;) (e.g. the C standard is also full of implementation defined behaviour, and that's fine). Instead of obsessing over theoretical C standard details, people should build their code with "-Wall -Wextra" (that's the absolute minimum), maybe -pedantic (which however disables a lot of useful non-standard extensions that are accepted by most popular compilers), run the code through a static analyzer, and test with ASAN, UBSAN and TSAN (and nowadays, also let an LLM do a bug scan over the code). When all those things are clean, the code is in pretty good shape and will most likely survive porting to a new target platform or compiler. UBSAN is also pragmatic enough to focus on the 'important' UB, and ignore the 'irrelevant' types of UB. | ||