On Wed, Aug 04, 2004 at 06:10:11PM +0100, Clive D.W. Feather wrote:
This can be tested at compile time: add to "struct dummy" a number of fields of the form:
int assert_size_spec_big_enough_for_char [MAX_INTEGRAL_TYPE_SIZE + 1 - sizeof (char)]; int assert_size_spec_big_enough_for_short [MAX_INTEGRAL_TYPE_SIZE + 1 - sizeof (short)]; int assert_size_spec_big_enough_for_int [MAX_INTEGRAL_TYPE_SIZE + 1 - sizeof (int)];
if you're going to do that, at least make it typedef int assert_size_spec_big_enough_for_char [MAX_INTEGRAL_TYPE_SIZE + 1 - sizeof (char)]; typedef int assert_size_spec_big_enough_for_short [MAX_INTEGRAL_TYPE_SIZE + 1 - sizeof (short)]; typedef int assert_size_spec_big_enough_for_int [MAX_INTEGRAL_TYPE_SIZE + 1 - sizeof (int)]; so that the compiler can barf if it wants to, but there's no impact on the generated code. -- |-----< "CODE WARRIOR" >-----| codewarrior@daemon.org * "ah! i see you have the internet twofsonet@graffiti.com (Andrew Brown) that goes *ping*!" werdna@squooshy.com * "information is power -- share the wealth."