Page MenuHomePhabricator

Making Things Fail
Updated 870 Days AgoPublic

To make compilation fail, use the #warning or #error preprocessor directives, such as follows:

#warning This file isn't done yet.
#error File deprecated.

You can wrap these in macro conditionals, but not in normal C++ control structures.

Alternatively, you can also use static_assert() to check things at compile time. However, since these are evaluated at compile time, not a runtime, they can only check constant expressions.

Last Author
Last Edited
Mar 27 2020, 5:10 PM