asctime.c

Clive D.W. Feather clive at demon.net
Thu Aug 5 06:29:48 UTC 2004


Andrew Brown said:
>> 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.

That's better, but the code Paul pointed me at already has a structure
containing these fields, which is why I did it that way. Paul should change
his code in the same way.

-- 
Clive D.W. Feather  | Work:  <clive at demon.net>   | Tel:    +44 20 8495 6138
Internet Expert     | Home:  <clive at davros.org>  | Fax:    +44 870 051 9937
Demon Internet      | WWW: http://www.davros.org | Mobile: +44 7973 377646
Thus plc            |                            |



More information about the tz mailing list