Hacker News new | ask | show | jobs
by flohofwoe 1161 days ago
We're very aware and try to shield ourselves somewhat with compiler options (eg. max warning level already goes a long way), sanitizers and analyzers (thankfully availability of such tools has improved dramatically with clang's ASAN, UBSAN, TSAN and the clang static analyzer).

(and actually: yes, some rules are benign if the major compilers agree on the same non-standard behaviour, so far I have never seen unions used for type punning break in C++ for instance - it's good that C++ now offers a 'proper' alternative though).

It's pretty much an illusion that any non-trivial C or C++ program can be entirely standard compliant, it always depends on the specific compilers it has been tested with - which is still a better situation than Rust, which only has a single implementation (so far).

1 comments

Yeah it is bonkers to me that people don't turn all the stuff on. There's a lot of help out there that is basically free. It's worth taking an hour or so to go through all the checks--if nothing else it'll probably make you wise to some new footguns.