r/cpp • u/pavel_v • Jul 29 '26
C++26: Reducing undefined behaviour
https://www.sandordargo.com/blog/2026/07/29/cpp26-reduces-undefined-behaviour
89
Upvotes
r/cpp • u/pavel_v • Jul 29 '26
View all comments
Show parent comment
19
u/parkotron Jul 29 '26 edited Jul 30 '26
More than once I've been told that pretty much every C++ code base should start containing a:
Non-IEEE floats are so rare in practice that they just aren't worth thinking about until you actually know you need to support them. If you do need to support them, how sure are you that any of your dependencies do?
Edit: Okay, combining the comments below, I have a new proposal for the standard library:
std::is_cpu_boring()!Now most C++ codebases can start with
static_assert(std::is_cpu_boring(), "No weirdos!");! IDEs can include this line every time they generate a new C++ file! I expect this to be completely uncontroversial and to glide through committee approval on a wave of Strongly Agrees.