void test() {
DM_STATIC_ASSERT(sizeof(int) == 4, Invalid_int_size);
}
Namespace: | dmStaticAssert |
Include: | #include <dmsdk/dlib/static_assert.h> |
MACROS | |
---|---|
DM_STATIC_ASSERT(x, xmsg) | 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.
x |
expression |
xmsg |
expression |
EXAMPLES
Verify the size of a struct is within a limitDM_STATIC_ASSERT(sizeof(MyStruct) <= 32, Invalid_Struct_Size);