Re: sizeof(int) in 64-bit C compilers

Jaap van Ganswijk <ganswijk@xs4all.nl>
18 Dec 1995 19:10:51 -0500

          From comp.compilers

Related articles
sizeof(int) in 64-bit C compilers d.sand@ix.netcom.com (1995-12-17)
Re: sizeof(int) in 64-bit C compilers ganswijk@xs4all.nl (Jaap van Ganswijk) (1995-12-18)
Re: sizeof(int) in 64-bit C compilers larryr@cybergate.com (Larry Rau) (1995-12-18)
Re: sizeof(int) in 64-bit C compilers streich@roo.mti.sgi.com (1995-12-19)
Re: sizeof(int) in 64-bit C compilers d.sand@ix.netcom.com (1995-12-19)
Re: sizeof(int) in 64-bit C compilers kennell@cs.purdue.edu (Richard L. Kennell) (1995-12-19)
Re: sizeof(int) in 64-bit C compilers karsten@tdr.dk (1995-12-28)
Re: sizeof(int) in 64-bit C compilers anton@complang.tuwien.ac.at (1995-12-28)
| List of all articles for this month |

From: Jaap van Ganswijk <ganswijk@xs4all.nl>
Newsgroups: comp.compilers
Date: 18 Dec 1995 19:10:51 -0500
Organization: Compilers Central
References: 95-12-094
Keywords: C, architecture

At 12:38 AM 12/17/95 -0500, Duane Sand wrote:
>A number of machines now support 32-bit and 64-bit addressing equally
>well, and some even have suitable C compilers that support both forms
>of programs. I would like to know which of these compilers have
>defined "int" to be 64-bits in their 64-bit-pointer codegen model, and
>which compilers have kept "int" as 32-bits as in their 32-bit-pointer
>model. The machines where this question arises include
> HP-PA, Sparc, Mips, Alpha, PowerPC.


The DEC-C compiler for DEC's OSF/1 (heet nu Dec Unix) on the
Alpha has int's of 32-bit and long's of 64-bit. (In 64-bit pointer code.)


>The Mips/SGI compilers define "int" as 32 bits in 32-bit-pointer code,
>and 64 bits in 64-bit-pointer code.


You are supposed to use the 32-bit pointer translation option only to
more easily port foreign or old (32-bit pointer) programs.


>This question is not just about C, since this choice tends to affect
>register-level call/return conventions for all languages on that
>machine, and whether programs can contain a mix of 32- and
>64-bit-pointer routines.


Indeed, it resulted in some nasty porting problems, especially
with implicit casting via function arguments and return values.


I also had code to swap the bytes in big/little endian numbers,
that assumed, that the 'higher 32-bit part' of a long was non-existing
and therefore filled with zeroes...


>Do any of the 64-bit-pointer versions of Unix support a mix of pointer
>sizes, via near and far qualifiers?


DEC doesn't, it seems.


The new ANSI-C standard may add a new type for 64-bit
integers, I read. I would certainly appreciate types like:
int8, int16, int32, int64 to be able to handle structured foreign
file data (like COFF-files) in a more portable fashion.


For the time being I defined these types in an include file...


It would also be nice to be able to handle big and little
endian type data (for example on a foreign file system)
in a portable way, but that is another matter...


Groeten,
Jaap


-- Chip Directory
-- http://www.hitex.com/chipdir/ - USA
-- http://www.xs4all.nl/~ganswijk/chipdir/ - Europe
-- (Many other international mirror sites from there...)
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.