Article View: comp.std.c
Article #4684Re: [Q] 16bit, 32bit, 64bit ints, longs etc.
From: Shankar Unni
Date: Mon, 22 Jan 1996 02:55
Date: Mon, 22 Jan 1996 02:55
29 lines
1666 bytes
1666 bytes
Koivisto Hannu (k152608@proffa.cc.tut.fi) wrote: > 64bit. You see, I thought that in 64bit systems ints would be 64bit and > longs 64bit. However, when I tried this with gcc running on an Alpha > machine, it turned out that ints are 32bit and longs are 64bit(of course, > pointers are also 64bit). [ Non-standards-related digression ] This is usually a matter of trading off programming convenience against loss of performance. If every loop counter and temporary value (ints) were 64 bits, your memory requirements could balloon. On the other hand, having ints be 32 bits means that if you forget to declare malloc() (a common failing in old code), you could end up with garbage.. It's a judgement call. Incidentally, many vendors are starting to ship files like "inttypes.h" (I know Solaris and Irix have this file; and I'm sure many others do as well), to declare integral types of known size, like "int32_t", "int64_t", etc., so that you can choose exactly what sizes you want regardless of the architecture you are porting your code to. -- Shankar Unni E-Mail: shankar@sgi.com Silicon Graphics Inc. Phone: +1-415-933-2072 URL: http://reality.sgi.com/employees/shankar
Technical Details
Message-ID:
<4duub7$3cf@fido.asd.sgi.com>Path:
arc1-ca.pugleaf.net!engr.sgi.com!shankarReferences:
<4dtgug$5mf@cc.tut.fi>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engr.sgi.com!shankar From: shankar@engr.sgi.com (Shankar Unni) Newsgroups: comp.std.c Subject: Re: [Q] 16bit, 32bit, 64bit ints, longs etc. Date: 22 Jan 1996 02:55:35 GMT Organization: Silicon Graphics, Inc., Mountain View, CA Distribution: world Message-ID: <4duub7$3cf@fido.asd.sgi.com> References: <4dtgug$5mf@cc.tut.fi> Reply-To: shankar@engr.sgi.com NNTP-Posting-Host: boris.engr.sgi.com X-Newsreader: TIN [version 1.2 PL2]