Mail Archives: djgpp/1998/01/21/05:07:07
John M. Aldrich wrote:
>
> That's the limit of the ANSI restrictions. However, most
> implementations preserve longs as 32 bits, simply because most
> architectures _are_ 32-bit, and most code assumes long to be 32 bits.
Such code breaks on the DEC Alpha.
> 64-bit integer implementation is spotty at best; perhaps when 64-bit
> systems become more prevalent we'll see a change.
On the DEC Alpha (which is 64-bit RISC) the sizes are:
short 16
int 32
long 64
And the GNU extension "long long" is the same as long (largely
because the 64-bit operations are builtin and 128-bit are not
very easy, the Alpha has no carry bit!).
Note that in this implementation a pointer can't fit into an int,
either, you have to use a long. And things like:
char buff[256];
unsigned int i;
... buff[256-i] ...
don't work - (256-i) is taken as unsigned (because i is unsigned),
which gives a large (but only 32 bit) unsigned number. This added
to the pointer/array gives an invalid address. Not an easy bug
to find...
Chris C
- Raw text -