🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4682

[Q] 16bit, 32bit, 64bit ints, longs etc.

#4682
From: Koivisto Hannu
Date: Sun, 21 Jan 1996 14:00
36 lines
2033 bytes
Heigh ho,

I know approximately what the current C standard says about this, and 
I've heard that there is upcoming updates to the standard, which address 
this issue. However, what I want to know is that what is "compiler 
vendors' standard" on this. I've noted that

In most 16bit architectures, ints are 16bit, longs are 32bit.
In most 32bit architectures, ints are 32bit, longs are 32bit.

Well, I don't care about 16bit systems, but what puzzles me is 32bit vs. 
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).

As I use Win32 API compatible types on all platforms, thought that when I 
really want exactly 32bit I could use DWORD and when I want the 
biggest/fastest integer I could use UINT. Of course, on ix86 platform 
DWORD and UINT are equally fast, but as far as I know, on Alpha 
machines(and most other 64bit architectures too) using anything but 64bit 
ints is a bad thing. So, if I continued using UINT, it wouldn't be 
optimal on 64bit architectures - I could use DWORD as well.

Well, I wrote my own types.h to address this issue, but I'd like to know 
about conventions... Is it really so that in most 64bit architectures 
ints are 32bit and longs are 64bit?


Thanks in advance!

--
Hannu "Azure" Koivisto | Saga microkernel, Prophet sub-system OS etc.
Prime Productions      | developer. Software R&D + music.
---------------------------------------------------------------------
What you see is all you get. -Brian Kernigham
Technical Details
Message-ID: <4dtgug$5mf@cc.tut.fi>
Path: arc1-ca.pugleaf.net!proffa.cc.tut.fi!k152608

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!proffa.cc.tut.fi!k152608
From: k152608@proffa.cc.tut.fi (Koivisto Hannu)
Newsgroups: comp.std.c
Subject: [Q] 16bit, 32bit, 64bit ints, longs etc.
Date: 21 Jan 1996 14:00:48 GMT
Organization: Prime Productions
Distribution: world
Message-ID: <4dtgug$5mf@cc.tut.fi>
NNTP-Posting-Host: proffa.cc.tut.fi
X-Newsreader: TIN [version 1.2 PL2]