top | item 37845401

(no title)

logdahl | 2 years ago

I kind of wish we had a form of preconditions/hints for the C compiler. There are lots of attributes, but those all look weird. Imagine annotating a calculation that 1 is a common value for example. or that a function is never called with a null-pointer.

discuss

order

variadix|2 years ago

With GCC/clang you can write an ASSERT/ASSUME macro that does this. Basically: if (!cond) __builtin_unreachable();