News for hackers. Stuff that matters.
Re:The C++ Iceberg by mpweiher on Wednesday May 08, 2024 @05:12AM (#40295880)
This turns out not to be the case.

Compilers have been known to remove exactly that sort of error checking code, as there was undefined behavior present.

It's a mess.

Re:The C++ Iceberg by Xeamek on Wednesday May 08, 2024 @05:22AM (#40295952)
Yes, I know it's not possible for a specific c++ dev to do such checks, as compilers can optimize them away.

What I meant is “we (as in) the c/c++ community (or rather the specification committee)” could tomorrow decide that, lets say, all null pointer dereferences should lead to program exit. Existence of UB is a choice.

Re:The C++ Iceberg by bigcheesegs on Wednesday May 08, 2024 @06:19AM (#40296287)
UB is a choice in that we could require symbolic execution of of all code. This is incredibly slow, so we don't.

There are many cases of UB that would be cheap to check, but there are many more that are incredibly expensive to check.