News for hackers. Stuff that matters.
Re:Why Not Just Do Simple C++ RAII in C? by fooker on Wednesday May 22, 2024 @04:45PM (#40446297)
> Given that has proven to be a completely false assumption

This part is correct. The problem is in how to deal with this. If you want the compiler to correctly deal with code having undefined behavior, often the only possibility is to assume that all code has undefined behavior. That means, almost every operation gets a runtime branch. That is completely incompatible with how modern hardware works.

The rest is wrong, but again, this is a common misconception. Language designers and compiler writers are not idiots, contrary to popular belief. UB as a concept exists for a reason. It's not for marginal performance boosts, it is to enable any compiler based transformation, and a notion of portability.

There are no comments on this comment yet.