"C++ Programming Language (Fourth Edition)" Chapter 2.4.3
static_assert(A,S) A is a constant expression. When A is not true, the compilation fails, and S will be output as a compiler error message.
#define debug qDebug()<<
constexpr int C = 299792458;
void debugValue(int value)
{
const int maxSpeed = 10000000000;
static_assert(maxSpeed < C,"You can't go faster than the speed of light");
debug "value = "<<value;
}
int main(int argc, char *argv[])
{
debugValue(2);
}