compile time assert

Does anyone know how to write a compiletime ASSERT?

If the condition is true, then don't generate any code. If it is false, then does #error Assert Failed to stop compilation.

Thanks,

Anh

Something like this:


if (condition)
{
}
else
{
#error Assert Failed
}

Parents Reply Children
No data
More questions in this forum