473,320 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Sizes of Integer Types

Hi,

I have a 32-bit machine... Is there anyway I can get gcc to use the
following integer sizes?
char: 8 bits
short: 16 bits
int: 32 bits
long: 64 bits
long long: 128 bits

Thanks!

Bob.

Sep 5 '07
159 6062
On Sep 13, 6:53 pm, lawrence.jo...@ugs.com wrote:
This might be a good place to note that N1256, an updated draft
incorporating the new TC3, has just been published:

<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf>

-Larry Jones
Lots of thanks for that link.

Now a quiz question: How is page 1 (that is the page after page xiv)
different from all the other pages?
Sep 14 '07 #151
pete wrote, On 13/09/07 23:43:
Flash Gordon wrote:
>Portability is not binary.

That's right.
It's defined in terms of "little or no modification".

ISO/IEC 2382-l : 1993

01.04.06
portability (of a program)
The capability of a program to be executed on various types
of data processing systems without converting the program
to a different language and with little or no modification.
Note that nowhere does it say *all* data processing systems. This is not
for pete, who obviously understands this, but for those who think that
you are throwing portability out the window if your SW won't run on all
implementations past, present and future.
--
Flash Gordon
Sep 15 '07 #152
christian.bau said:
On Sep 13, 6:53 pm, lawrence.jo...@ugs.com wrote:
>This might be a good place to note that N1256, an updated draft
incorporating the new TC3, has just been published:

<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf>

-Larry Jones

Lots of thanks for that link.

Now a quiz question: How is page 1 (that is the page after page xiv)
different from all the other pages?
In finest rec.puzzles tradition, I've included some "spoiler space", so
that those who would rather try to find the answer themselves can do so
by simply not reading this reply any further.
s
p
o
i
l
e
r
s
p
a
c
e
s
p
o
i
l
e
r
s
p
a
c
e s
p
o
i
l
e
r
s
p A N Y
a
c
e s
p
o
i
l
e
r
s
p M O M E N T
a
c
e s
p
o
i
l
e
r
s
p N O W
a
c
e

It doesn't contain a mis-spelling of "September".

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Sep 15 '07 #153
On 2007-09-14 23:41, Charlie Gordon <ne**@chqrlie.orgwrote:
"jacob navia" <ja***@jacob.remcomp.fra écrit dans le message de news:
46***********************@news.orange.fr...
>Keith Thompson wrote:
>>"Charlie Gordon" <ne**@chqrlie.orgwrites:
"Al Balmer" <al******@att.neta écrit dans le message de news:
ja********************************@4ax.com...
On Thu, 13 Sep 2007 02:06:56 +0200, "Charlie Gordon"
<ne**@chqrlie.orgwrote:
[...]
>Such biests are disappearing fast at this time,
They are?
Can you name counter examples ?

Aside from the DS9000 and some surviving Unisys mainframes, no one
came up with real life examples of contemporary architectures with
non twos-complement arithmetics, padding bits, trap values and
similar obsolete crap.
[...]
I am calling for examples, and this is not a valid one.
But surely the C99 folks must have had more than a few in mind when they
mulled the Standard.

Keep in mind that this was about 10 years ago. The Unisys mainframes you
mentioned above were still very much in use in the late '90s (the last
model was introduced in 1997), but most of them have probably been
replaced by now or will be when the first compilers for C09 appear, so
they probably won't influence the committee much now. (Speaking of C09:
Will there be a C09 and if so, what can we expect of it?)

hp
--
_ | Peter J. Holzer | I know I'd be respectful of a pirate
|_|_) | Sysadmin WSR | with an emu on his shoulder.
| | | hj*@hjp.at |
__/ | http://www.hjp.at/ | -- Sam in "Freefall"
Sep 15 '07 #154
[snips]

On Sat, 15 Sep 2007 00:25:02 +0100, Flash Gordon wrote:
Fixed width types are, IMHO, the perfect types for memory mapped HW.
Since then the HW defines it being N bits wide.
Agreed. They are.
I also see them as useful (but not as important) for interfaces which
will be writing binary data and the specification says the data will be
exactly N bits wide (the routine actually doing the read/write still has
to handle endianness, obviously.
Again, agreed.

Here, however, is the question: before the new int types, were you
prevented from writing such code? Or did writing such code impose a
significant burden on you?

Let's emphasize that a bit: was the code of this sort, for the last 30
years or so, such a burden to write that it actually needed the standard
to be modified to include the new types? Bearing in mind the cost and
effort of actually writing new things into the standard?

So far the answer to that, based on what's been offered here, has been a
resounding "no", yet that's about the only justification thus offered for
these types.

Yes, there are benefits. Do those benefits outweigh the costs? Not as
far as anyone here has even begun to hint at.
Sep 16 '07 #155
On Fri, 14 Sep 2007 11:46:53 +0200, "Charlie Gordon"
<ne**@chqrlie.orgwrote:
>>
Arithmetic isn't everything.

Arithmetic can by relied upon more readily than representation.
My point is that computers are used to do other things than
arithmetic. Masking a 16-bit register to 8 bits does not make it an
8-bit register.

--
Al Balmer
Sun City, AZ
Sep 17 '07 #156
On Fri, 14 Sep 2007 11:41:13 +0200, "Charlie Gordon"
<ne**@chqrlie.orgwrote:
>"Al Balmer" <al******@att.neta écrit dans le message de news:
ja********************************@4ax.com...
>On Thu, 13 Sep 2007 02:06:56 +0200, "Charlie Gordon"
<ne**@chqrlie.orgwrote:
>>>It would have been good to mandate their support on _all_ architectures.
Odd bit sized and non 2's complement machines could emulate them in
software...

For purposes of calculation they could. Probably even for purposes of
satisfying the standard. But there might be times when you actually
need the hardware to be able to write say 16 bits and no more, such as
for writing to a 16-bit memory mapped port, where the adjacent 16 bits
is a different port.

You can't really do that portably. If you need bit addressability to your
hardware, you are beyond the scope of the C language.
Unless you have the stdint types. That's what we're talking about.
>
>>>Such biests are disappearing fast at this time,

They are?

Can you name counter examples ?
There are many wonders in the world of embedded computing.

--
Al Balmer
Sun City, AZ
Sep 17 '07 #157
On Thu, 13 Sep 2007 12:22:47 -0700, Kelsey Bjarnason
<kb********@gmail.comwrote:
>You keep saying that. The new types *are* required to exist

Really? So uint8_t exists on a machine with 64-bit char and short and int
and long? No, it doesn't. Continuing...
>>, if the
implementation can support them.
I give up. There's no point to discussing an issue with someone who
argues by quoting half-sentences. You ran out of rational points long
ago, and are just playing. I have better things to do.

--
Al Balmer
Sun City, AZ
Sep 17 '07 #158
On Thu, 13 Sep 2007 13:53:21 -0400, la************@ugs.com wrote:
>This might be a good place to note that N1256, an updated draft
incorporating the new TC3, has just been published:

<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf>
Thank you. Downloading now.

--
Al Balmer
Sun City, AZ
Sep 17 '07 #159
"Al Balmer" <al******@att.neta écrit dans le message de news:
0s********************************@4ax.com...
On Fri, 14 Sep 2007 11:46:53 +0200, "Charlie Gordon"
<ne**@chqrlie.orgwrote:
>>>
Arithmetic isn't everything.

Arithmetic can by relied upon more readily than representation.

My point is that computers are used to do other things than
arithmetic. Masking a 16-bit register to 8 bits does not make it an
8-bit register.
What exactly do you call a register? I don't the C standard can help in
dealing with CPU registers or memory mapped I/O registers...

If your implementation gives you adequate control over these, and uint8_t
and uint16_t types are fit for this purpose, no problem.

But for implementing algorithms that require 2s-complement exact size 8, 16,
32 or 64 bits, it would be helpful if the Standard mandated the support of
the corresponding types. The commitee decided it was not helpful enough to
balance the extra work needed for weird platforms, so be it.

I don't quite agree with them, they did mandate long long, and floating
point arithmetics for all conforming platforms, that's more work than
supporting 2s complement 8/16/32 bits arithmetics on the rare if not
inexistent architectures that don't support it already.

I personally regret that it is not possible in C to describe actual data
structures stored in files with more precision. I would want to tell the
compiler about endianness, alignment and representation and have it generate
the best code for the target architecture. Code that deals with memory
mapped files, device driver I/O space, Graphics chips, would be so much more
readable.

--
Chqrlie.
Sep 19 '07 #160

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

Similar topics

8
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...
14
by: David Fisher | last post by:
The most common sizes of integer types seem to be: 8 bits - signed char 16 bits - short 16 or 32 bits - int 32 or 64 bits - long Question #1: Does anyone know how common sizes other than...
25
by: gamehack | last post by:
Hi all, I'm writing an application which will be opening binary files with definite sizes for integers(2 byte integers and 4 byte longs). Is there a portable way in being sure that each integer...
14
by: Michael Brennan | last post by:
Hi, I wonder if there is any good reason to let different systems have different sizes of short, int and long? I think that makes it harder to plan which type to use for your program. For...
13
by: Ioannis Vranos | last post by:
Is there any mentioning in the standard of the number of bits of the various built in types, apart from char/signed char/unsigned char types? Or only about the minimum value ranges of them?
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.