Static Assert

void test() {
    DM_STATIC_ASSERT(sizeof(int) == 4, Invalid_int_size);
}

DM_STATIC_ASSERT

compile time assert

This is using C++11 static_assert on platforms that support it and use c++11. Otherwise it's using a c construct to check the condition. As such, it is currently required to be used whithin a function scope.

PARAMETERS

x - expression

xmsg - expression

EXAMPLES

Verify the size of a struct is within a limit

DM_STATIC_ASSERT(sizeof(MyStruct) <= 32, Invalid_Struct_Size);