Re: [sv-bc] enums in packed arrays

From: Steven J. Dovich <dovich_at_.....>
Date: Wed Apr 12 2006 - 07:00:50 PDT
Brad Pierce wrote:
>> Good portable code in C/C++ does not know what the length of an int is.
>>     
>
> Agreed.  And in Verilog-2005, the length of an 'integer' is not even
> specified, except to say that must be at least 32 bits long.
>   
Don't be so quick to agree. Those who read ISO 9899 (C Language) will 
find that quality portable code can in fact know this, because 
conforming implementations must provide the appropriate manifest constants:

    #include <limits.h>
    int int_bits = CHAR_BITS * sizeof(int);      /* portable and 
accurate for all conforming implementations */

The above code is accurate despite the fact that "int" may be any width 
greater than 16 bits.

/sjd
Received on Wed Apr 12 07:00:54 2006

This archive was generated by hypermail 2.1.8 : Wed Apr 12 2006 - 07:01:14 PDT