3 ms·
The eighth line uses the static_assert keyword, which is a feature of C++11 C11 already had _Static_assert() and static_assert() in assert.h
by kevin_thibedeau 3y ago
The eighth line uses the static_assert keyword, which is a feature of C++11
C11 already had _Static_assert() and static_assert() in assert.h
- jwolfe 3y agoThat's already noted at the end: > The idea behind static_assert is great. You run a check that has no impact on the performance of the software, and may even help it. It is cheap and it can catch nasty bugs. It is not new to C, but adopting the C++ syntax is a good idea.
- Brian_K_White 3y agofta "It is not new to C, but adopting the C++ syntax is a good idea."
- zeckalpha 3y agoDid that work at compile time?
- jonathrg 3y agoWhat would it mean for _Static_assert to not work at compile time?
- hmry 3y agoThe keyword is new though
- lifthrasiir 3y agoMore accurately: C23 makes `static_assert` a keyword and remove `#define static_assert _Static_assert` in <assert.h>, so `#include <assert.h>` is no longer needed for `static_assert`. So the syntax was always supported since C11 but it's made more convenient to use.