r/cpp • u/pavel_v • Mar 27 '26
C++26: A User-Friendly assert() macro
https://www.sandordargo.com/blog/2026/03/25/cpp26-user-friendly-assert
53
Upvotes
r/cpp • u/pavel_v • Mar 27 '26
View all comments
Show parent comment
14
u/Fabulous-Meaning-966 Mar 27 '26
Careful with translating
assertto__builtin_assumein release builds: you end up injecting UB into production code whenever the assumption fails. I had exactly the same idea a while ago and was talked out of it by folks who have seen it blow up horribly in production with impossible-to-debug miscompilations (__builtin_unreachablehas the same problem).