Absolute size of 'short'

Chip Salzenberg chip at ateng.uucp
Wed Sep 7 02:10:50 AEST 1988


According to karl at haddock.ima.isc.com (Karl Heuer):
>	typedef short int_9, int_10, /*...*/, int_16;
>	typedef long  int_17, /*...*/, int_32;
[etc.]
>(One admitted flaw: the bitwidth must be specified directly in this scheme;
>you can't compute it at compile-time.)

Perhaps you can:

    #define xintbits(n)     int_ ## n
    #define intbits(n)      xintbits(n)

    /* The nested macro expands the argument before concatenating tokens. */

    #define COLORBITS       9

    typedef intbits(COLORBITS)  color_t;

-- 
Chip Salzenberg                <chip at ateng.uu.net> or <uunet!ateng!chip>
A T Engineering                My employer may or may not agree with me.
	  The urgent leaves no time for the important.



More information about the Comp.lang.c mailing list