4 ms·
The signature for static_assert(3) in C has a second argument that is `char *msg`. With C23 onwards, it becomes optional.
by tleb_ 3y ago
The signature for static_assert(3) in C has a second argument that is `char *msg`. With C23 onwards, it becomes optional.
- marginalia_nu 3y agoJava has this too. assert isSorted(array, start, end) : "The input array for binary search is expected to be sorted"; That said, I think in many cases asserts tend to be fairly self-evident, they typically just list the invariants, e.g. assert start <= end; assert (end - start) % stepSize == 0; // some logic assert pos - start >= 0; assert pos - end < 0; assert (pos-start) % stepSize == 0; return pos;