Comment by bluecalm
3 days ago
I think they are there to help the compiler so the optimizer might (but doesn't have to) assume they are true. It's sometimes very useful to be able to do so. For example if you know that two numbers are always different or that some value is always less than x. In standard C it's impossible to do but major compilers have a way to express it as extensions. GCC for example has:
if (x)
__builtin_unreachable();
C3 makes it a language construct. If you want runtime checks for safety you can use assert. The compiler turns those into asserts in safe/debug mode because that help catching bugs in non performance critical builds.
In the current C standard that's unreachable() from <stddef.h>
Thank you, I've just recently read the list of new features and missed this one!