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
1
u/EC36339 Mar 28 '26
Fair enough.
But violating the assumptions of your code can cause UB.
And the distinction is more academic than practical, because a violation of the assumptions of your code may have worse consequences than an actual UB.
(Actual UB does in most cases lead to a crash. Robust architectures can handle crashes by having watchdogs that restart processes. UB is difficult to exploit by attackers, because it is ... well ... undefined. A deterministic, reproducible contract violation in the code, however, can have effects that have no mitigation and may enable repeatable and discoverable exploits)