Pokology - a community-driven site around GNU poke

_____ ---' __\_______ ______)

Frequently Asked Questions

__) __) ---._______) Table of Contents _________________ 1. Language .. 1. Is there an equivalent of _Static_assert(sizeof(struct my_struct) = 48)? 1 Language ========== 1.1 Is there an equivalent of _Static_assert(sizeof(struct my_struct) = 48)? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If the struct type My_Struct is complete, i.e. its size can be determined at compile-time, then you can do this: ,---- | assert (1#My_Struct == 48#B) `---- Otherwise you can construct a struct value and use the 'size attribute like this: ,---- | assert (My_Struct{}'size == 48#B) `----