473,661 Members | 2,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C Primitive Data Type Sizes

Kip
Greetings everyone,

Is there anyone here who could point me to a page or pdf that has a
list of the sizes of all of the C primitive data types on various
implementations such as SPARC, x86, PowerPC, etc?

Thank you.

--
Kip Warner
Vertigo
http://TheVertigo.com
Nov 15 '05 #1
26 12006
In article <xn************ ***@news.telus. net>,
Kip <Ki*********@Th eVertigo.com> wrote:
Is there anyone here who could point me to a page or pdf that has a
list of the sizes of all of the C primitive data types on various
implementation s such as SPARC, x86, PowerPC, etc?


You listed chips, but C primitive types can be (and often
have been) implimented in library code.

The size of C primitive types is dependant on the compiler...
which usually takes hints from the underlying hardware, but is
not bound by it.
--
Usenet is like a slice of lemon, wrapped around a large gold brick.
Nov 15 '05 #2
Kip
Walter Roberson wrote:
In article <xn************ ***@news.telus. net>,
Kip <Ki*********@Th eVertigo.com> wrote:
Is there anyone here who could point me to a page or pdf that has a
list of the sizes of all of the C primitive data types on various
implementations such as SPARC, x86, PowerPC, etc?


You listed chips, but C primitive types can be (and often
have been) implimented in library code.

The size of C primitive types is dependant on the compiler...
which usually takes hints from the underlying hardware, but is
not bound by it.


Thanks. But it still begs the question of whether or not anyone here
could point me to a page or pdf that has a list of the sizes on all of
the C primitive data types on various implementations ?

--
Kip Warner
Vertigo
http://TheVertigo.com
Nov 15 '05 #3
<posted & mailed>

No. The sizes are dependent not only on the processor, but also the
operating environment and, in some cases, the compiler used. Consult the
compiler documentation for each that you are interested in.
Kip wrote:
Greetings everyone,

Is there anyone here who could point me to a page or pdf that has a
list of the sizes of all of the C primitive data types on various
implementations such as SPARC, x86, PowerPC, etc?

Thank you.


--
Remove '.nospam' from e-mail address to reply by e-mail
Nov 15 '05 #4
Me
> Is there anyone here who could point me to a page or pdf that has a
list of the sizes of all of the C primitive data types on various
implementations such as SPARC, x86, PowerPC, etc?


The answer to your question is probably meaningless for what you're
trying to determine anyway (other than knowing about the data types of
existing C implementations , which is a bad question to ask IMHO).
Knowing the size of primitive data types tells you nothing about them
except how much space they take up in relation to a char. It doesn't
tell you anything about how many padding bits a type has, what encoding
it uses for signed integers, alignment requirements, bit ordering, trap
representations , etc. And an implementation of C doesn't depend on the
underlying hardware, it depends on the C compiler and whatever possible
modes it supports. It's entirely possible for it to emulate 9-bit chars
on an 8-bit machine for example. Why would it do something like that?
Well because it's free to do so and it helps debug non-portable
assumptions about C for those of us that prefer to write code according
to what the standard guarantees a conforming implementation must
support.

Nov 15 '05 #5
On Mon, 04 Jul 2005 23:58:28 +0000, Kip wrote:

....
Thanks. But it still begs the question of whether or not anyone here
could point me to a page or pdf that has a list of the sizes on all of
the C primitive data types on various implementations ?


I don't know of such a list offhand. I'm curious to know however what you
would use such a list for if you find one.

Lawrence

Nov 15 '05 #6
In article <xn************ ***@news.telus. net>, Kip
<Ki*********@Th eVertigo.com> writes
Walter Roberson wrote:
In article <xn************ ***@news.telus. net>,
Kip <Ki*********@Th eVertigo.com> wrote:
> Is there anyone here who could point me to a page or pdf that has a
> list of the sizes of all of the C primitive data types on various
> implementations such as SPARC, x86, PowerPC, etc?


You listed chips, but C primitive types can be (and often
have been) implimented in library code.

The size of C primitive types is dependant on the compiler...
which usually takes hints from the underlying hardware, but is
not bound by it.


Thanks. But it still begs the question of whether or not anyone here
could point me to a page or pdf that has a list of the sizes on all of
the C primitive data types on various implementations ?


I doubt such a list exists.

start with:- Char 3,4,5,6,7,8,9 bits and go down hill from there :-)
the problem is that there are very many architectures still in use if
not common.

type pdp11 vax 68000 Cray-2 Unisys Harris 80386
series family 1100 H800

char 8 8 8 8 9 8 8
short 8 8/16 16/16 64(32) 18 24 8/16
int 16 16/32 16/32 64(32) 36 24 16/32
long 32 32 32 64 36 48 32
char * 16 32 32 64 72 24 16/32/48
int * 16 32 32 64(24) 72 24 16/32/64
int (*) 16 32 32 64 56 24 16/32/64


This list is not exhaustive by a LONG LONG way. :-(

Nov 15 '05 #7
In article <HA************ **@phaedsys.dem on.co.uk>,
Chris Hills <ch***@phaedsys .demon.co.uk> wrote:
In article <xn************ ***@news.telus. net>, Kip
<Ki*********@T heVertigo.com> writes
Thanks. But it still begs the question of whether or not anyone here
could point me to a page or pdf that has a list of the sizes on all of
the C primitive data types on various implementations ?

I doubt such a list exists. start with:- Char 3,4,5,6,7,8,9 bits and go down hill from there :-)
Though fortunately char sizes smaller than 8 are not compatible with
the standards, so we do not have to worry about those cases when dealing
with standard C. (One might have to worry about them if one is
writing for a version of C adapted for a specialized processor.)

the problem is that there are very many architectures still in use if
not common.
And the answer can depend on how one compiles...
type pdp11 vax 68000 Cray-2 Unisys Harris 80386
series family 1100 H800

I hope that examing this table of one signal OS's processor family
will convince Kip that in listing major chips lines, he is asking the
wrong question.
SGI, MIPS chips, compiled with SGI's cc compilers in -coff mode
char 8, short 16, int 32, long 32, char * 32, int * 32, int (*) 32

R2000 - IRIX 2, IRIX 3.1, IRIX 3.2
R3000 - IRIX 3.2, IRIX 3.3, IRIX 4.*, IRIX 5.*
R4000 - IRIX 4.0.3 - IRIX 5.*
R4400 - IRIX 5.3
R4600PC - IRIX 5.2 for Indy R4600PC & Challenge S, IRIX 5.3
R4600SC - IRIX 5.2 for Indy R4600SC/XZ & Presenter, IRIX 5.3
R5000 - IRIX 5.3
R8000 - IRIX 6.0, IRIX 6.1
R10000 - not supported
R12000 - not supported
R14000 - not supported
SGI, MIPS chips, compiled with SGI's cc compilers in -o32 mode or -n32 mode
char 8, short 16, int 32, long 32, char * 32, int * 32, int (*) 32
(Note: -o32 mode does not support any 64 bit system calls such as stat64()
or lseek64(), and file sizes are limited to 2 GB. -n32 mode does not
have these restrictions.)

R2000 - not supported
R3000 - not supported
R4000 - IRIX 6.2*, IRIX 6.5 - IRIX 6.5.13-ish
R4400 - IRIX 6.2*, IRIX 6.5 - IRIX 6.5.22
R4600PC - IRIX 6.2*, IRIX 6.5 - IRIX 6.5.?
R4600SC - IRIX 6.2*, IRIX 6.5 - IRIX 6.5.?
R5000 - IRIX 5.3 for R5000 Indy, IRIX 5.3 Indy R5000 with XFS, IRIX 6.2,
IRIX 6.3, IRIX 6.5 - IRIX 6.5.22
R8000 - IRIX 6.0*, IRIX 6.1, IRIX 6.5
R10000 - IRIX 6.2, IRIX 6.5.*
R12000 - early IRIX 6.5.* onward
R14000 - somewhere near IRIX 6.5.17 onward
R16000 - somewhere near IRIX 6.5.23 onward
SGI, MIPS chips, compiled with SGI's cc compilers in -64 mode
char 8, short 16, int 32, long 64, char * 64, int * 64, int (*) 64

R2000 - not supported
R3000 - not supported
R4000 - not supported.
Note: the R4000 has full support for 64 bit arithmetic, and was
-designed- to support 64 bit pointers, but it had a bug in the chip mask
that made 64 bit pointers impractical.
R4400 - IRIX 6.2, IRIX 6.5 - IRIX 6.5.22
R4600PC - not supported
R4600SC - not supported
R5000 - not supported
R8000 - IRIX 6.1, IRIX 6.5 - IRIX 6.5.22
R10000 - IRIX 6.2, IRIX 6.4, IRIX 6.5*
R12000 - early IRIX 6.5.* onward
R14000 - somewhere near IRIX 6.5.17 onward
R16000 - somewhere near IRIX 6.5.23 onward
--
"Never install telephone wiring during a lightning storm." -- Linksys
Nov 15 '05 #8
On Tue, 5 Jul 2005 10:46:19 +0100, Chris Hills
<ch***@phaedsys .org> wrote:
start with:- Char 3,4,5,6,7,8,9 bits and go down hill from there :-)
Er, char can only be 8 bits or more (at least in standard C). But my
favourite implementation of the DS9000 has char as 11 bits:

sizeof short 2
sizeof int 3
sizeof long 5
sizeof long long 7
the problem is that there are very many architectures still in use if
not common.

type pdp11 vax 68000 Cray-2 Unisys Harris 80386
series family 1100 H800

char 8 8 8 8 9 8 8
short 8 8/16 16/16 64(32) 18 24 8/16
8 bit short is not allowed by the standard.
int 16 16/32 16/32 64(32) 36 24 16/32
long 32 32 32 64 36 48 32
char * 16 32 32 64 72 24 16/32/48
Which 80386 compiler has 48 bit char pointers? Just curious...
int * 16 32 32 64(24) 72 24 16/32/64
int (*) 16 32 32 64 56 24 16/32/64

This list is not exhaustive by a LONG LONG way. :-(


Or even a long double way <g>...

Chris C
Nov 15 '05 #9
>> type pdp11 vax 68000 Cray-2 Unisys Harris 80386
series family 1100 H800

char * 16 32 32 64 72 24 16/32/48


Which 80386 compiler has 48 bit char pointers? Just curious...


Any large-model 32-bit-mode i*86 compiler would need this, so you're
not limited to only 4GB code or only 4GB data (the pointer includes
the segment register, for a total of 48 bits). As to whether there
actually are any on the market, I'm not sure.

Gordon L. Burditt
Nov 15 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
5914
by: Ken | last post by:
Hi. Does the Java spec mandate set sizes for primitive types (e.g., int, float, char, etc.)? I know the ANSI C++ standard does not do this, which makes these sizes compiler dependent. So I guess I'm trying to figure out if in Java these sizes are compiler or JVM dependent. Thanks! Ken
1
591
by: Kip | last post by:
Greetings everyone, Is there anyone here who could point me to a page or pdf that has a list of the sizes of all of the C primitive data types on various implementations such as SPARC, x86, PowerPC, etc? Thank you. -- Kip Warner
9
1620
by: Gonçalo Rodrigues | last post by:
Hi all, I have a few questions on primitive types that I will divide in two main questions. I realize that some of these questions -- especially 2. below -- are not directly related to C++ as a language itself, so, if there is a better newsgroup to make them would you be so kind and please direct me to it? 1. Assume that in your platform (OS + compiler) all pointer types have the same size. Is there a platform independent way to get...
4
3854
by: Thomas Paul Diffenbach | last post by:
Can anyone point me to an open source library of /statically allocated/ data structures? I'm writing some code that would benefit from trees, preferably self balancing, but on an embedded system that doesn't offer dynamic memory allocation (to be clear: no malloc, no realloc), and with rather tight memory constraints. Writing my own malloc to do dynamic allocation from some static pool isn't really an option, for various reasons, not...
14
7411
by: Matt | last post by:
I want to know if "int" is a primitive type, or an object? For example, the following two approaches yield the same result. > int t1 = int.Parse(TextBox2.Text); //method 1 > int t2 = System.Int32.Parse(TextBox2.Text); //method 2 And people said "int" is a C# alias for "System.Int32". If this is the case, can we say "int" is an object??
5
3398
by: rAinDeEr | last post by:
Hi, I have a web application with a table to store terms and conditions of a Company. This may some times run into many pages and some times it may be just a few sentences. It is a character text field. I want to know which Data type I need to use so that it doesnt waste memory. thanks in advance, rAinDeEr
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8754
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8630
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7362
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4177
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4343
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2760
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1984
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.