logoalt Hacker News

esrauchlast Saturday at 8:04 PM1 replyview on HN

Yes, and that same pattern already does exist in C and C++. Asserts that are checked in debug builds but presumed true for optimization in release builds.


Replies

mananaysiemprelast Saturday at 8:46 PM

Not unless you write your own assert macro using C23 unreachable(), GNU C __builtin_unreachable(), MSVC __assume(0), or the like. The standard one is defined[1] to either explicitly check or completely ignore its argument.

[1] https://port70.net/~nsz/c/c11/n1570.html#7.2

show 1 reply