Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The static_assert() macro accepts a constant expression e, which is evaluated as the first operand to the conditional operator. If e evaluates to nonzero, an array type with a size of 1 is defined; otherwise, an array type with a size of -1 is defined. Because it is invalid to declare an array with a negative size, the resulting type definition will be flagged by the compiler. The name of the array is used to indicate the location of the failed assertion.

See recommendation ? DCL03-C. Use a static assertion to test the value of a constant expression

...