Tech News
← Home  ·  All topics

C 26

2 GoKawiil briefs on this topic

C++26 standard makes empty infinite loops well-defined behavior

The upcoming C++26 standard, via proposal P2809R3, changes the language so that trivial infinite loops like 'while(true);' are no longer undefined behavior. Previously, compilers such as Clang could legally assume such loops terminate and optimize them away entirely, sometimes causing code after the loop to execute unexpectedly. Because the fix was also accepted as a defect report, compiler vendors may backport it to earlier C++ standard modes too.

C++26 adds optional 'hardened' mode to catch standard library errors

C++26 introduces the concept of a hardened implementation for the standard library, where operations like std::vector's operator[] that previously caused undefined behavior on invalid access now trigger a defined contract violation instead—if the implementation enables hardening. The standard leaves it up to each implementation to decide whether and how this hardened mode is turned on.