integer sizes
mwm at ucbtopaz.CC.Berkeley.ARPA
mwm at ucbtopaz.CC.Berkeley.ARPA
Mon Mar 4 22:48:29 AEST 1985
In article <8871 at brl-tgr.ARPA> gwyn at Brl-Vld.ARPA (VLD/VMB) writes:
>ANSI C will guarantee minimum sizes for integer types.
>A short or an int will have 16 bits minimum and a long
>will have 32 bits minimum. For other sizes, round up.
>For more than 32 bits, find another way.
You mean, if I've got a program that needs values around 5 billion, and a
compiler/machine that has 60 bit longs, I shouldn't use C????
Likewise, if I've got a machine that has 18 bit shorts and (expensive!) 36
bit longs, and I need values around 100,000, I should use the longs?
Nuts to that. I'll use "uint60" and "int17", and give you a copy of the
include file that defines them. If you refuse to fix the include file, the
code will die. But that's your problem, not mine.
<mike
Here's a the first piece of that include file, just to show you how easy
this is to do:
/*
* Size definition for a generic byte oriented machine. Compiler needs to
* understand "signed/unsigned byte", and "unsigned short/long" types.
*/
/* signed ints, size must have extra bit for sign */
typedef signed char int1 ;
typedef signed char int2 ;
typedef signed char int3 ;
typedef signed char int4 ;
typedef signed char int5 ;
typedef signed char int6 ;
typedef signed char int7 ;
typedef short int8 ;
typedef short int9 ;
typedef short int10 ;
typedef short int11 ;
typedef short int12 ;
typedef short int13 ;
typedef short int14 ;
typedef short int15 ;
typedef long int16 ;
typedef long int17 ;
More information about the Comp.lang.c
mailing list