By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,728 Members | 753 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,728 IT Pros & Developers. It's quick & easy.

Minimum sizes of integral and floating point types

P: n/a
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?
Mar 8 '08 #1
Share this Question
Share on Google+
13 Replies


P: n/a
Ioannis Vranos wrote:
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?
It's actually in the C Standard. C++ Standard inherits those.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Mar 8 '08 #2

P: n/a
Victor Bazarov wrote:
Ioannis Vranos wrote:
>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?

It's actually in the C Standard. C++ Standard inherits those.

Yes, I knew that. Anyone with something more specific?
Mar 8 '08 #3

P: n/a
In article <fq***********@ulysses.noc.ntua.gr>,
iv*****@nospam.no.spamfreemail.gr says...
Victor Bazarov wrote:
Ioannis Vranos wrote:
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?
It's actually in the C Standard. C++ Standard inherits those.


Yes, I knew that. Anyone with something more specific?
Section 5.2.4.2

--
Later,
Jerry.

The universe is a figment of its own imagination.
Mar 9 '08 #4

P: n/a
Ioannis Vranos wrote:
Victor Bazarov wrote:
>Ioannis Vranos wrote:
>>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?

It's actually in the C Standard. C++ Standard inherits those.

Yes, I knew that. Anyone with something more specific?
You've already asked on c.l.c, why ask again here?

--
Ian Collins.
Mar 9 '08 #5

P: n/a
Jerry Coffin wrote:
In article <fq***********@ulysses.noc.ntua.gr>,
iv*****@nospam.no.spamfreemail.gr says...
>Victor Bazarov wrote:
>>Ioannis Vranos wrote:
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?
It's actually in the C Standard. C++ Standard inherits those.

Yes, I knew that. Anyone with something more specific?

Section 5.2.4.2

In C++03, section 5.2.4 is about "Pseudo destructor call". Nothing
relevant ro my question there.
Mar 9 '08 #6

P: n/a
Ian Collins wrote:
Ioannis Vranos wrote:
>Victor Bazarov wrote:
>>Ioannis Vranos wrote:
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?
It's actually in the C Standard. C++ Standard inherits those.
Yes, I knew that. Anyone with something more specific?

You've already asked on c.l.c, why ask again here?

Because I am interested in both C95 and C++03.
Mar 9 '08 #7

P: n/a
Ioannis Vranos wrote:
Ian Collins wrote:
>Ioannis Vranos wrote:
>>Victor Bazarov wrote:
Ioannis Vranos wrote:
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?
It's actually in the C Standard. C++ Standard inherits those.
Yes, I knew that. Anyone with something more specific?

You've already asked on c.l.c, why ask again here?


Because I am interested in both C95 and C++03.
C++ inherits this from C. The reference Jerry gave you was from the C
standard.

--
Ian Collins.
Mar 9 '08 #8

P: n/a
In article <fq**********@ulysses.noc.ntua.gr>,
iv*****@nospam.no.spamfreemail.gr says...
Jerry Coffin wrote:
In article <fq***********@ulysses.noc.ntua.gr>,
iv*****@nospam.no.spamfreemail.gr says...
Victor Bazarov wrote:
Ioannis Vranos wrote:
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?
It's actually in the C Standard. C++ Standard inherits those.

Yes, I knew that. Anyone with something more specific?
Section 5.2.4.2


In C++03, section 5.2.4 is about "Pseudo destructor call". Nothing
relevant ro my question there.
As noted above, the C standard is what's relevant here, so you need to
look at section 5.2.4.2 of the C standard (the C99 standard, to be
specific).

--
Later,
Jerry.

The universe is a figment of its own imagination.
Mar 9 '08 #9

P: n/a
On 8 mar, 23:09, Ioannis Vranos <ivra...@nospam.no.spamfreemail.gr>
wrote:
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?
No. But for integral types, the standard does impose a pure
binary representation, so the minimum value ranges do impose a
minimum number of bits. For floating point types, the standard
imposes minimum ranges and precision, which also imposes a
minimum amount of information present---if a "bit" is a binary
digit, this also imposes a certain minimum number of bits.

There's also a requirement that sizeof be an integral type, and
that you can examine all of the bits of an object (regardless of
its type) using unsigned char. Independently of the requirement
that CHAR_BIT be at least 8, this would forbid the usual PDP-10
organization of 36 bit words, with 5 7 bit bytes per word (and
one unused bit). It doesn't require that all bits participate
in the value representation, however---on a Unisys MCP, for
example, you can see all 48 bits of an int accessing it as an
array of [6] unsigned char, but only 40 participate in the value
representation, and only 39 can be accessed using unsigned int
with shift and masking operations.

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

Mar 9 '08 #10

P: n/a
James Kanze wrote:
On 8 mar, 23:09, Ioannis Vranos <ivra...@nospam.no.spamfreemail.gr>
wrote:
>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?

No. But for integral types, the standard does impose a pure
binary representation, so the minimum value ranges do impose a
minimum number of bits.

Do you mean that all integer types, signed and unsigned, are required to
not have padding bits?
Mar 9 '08 #11

P: n/a
On 2008-03-09 13:33, Ioannis Vranos wrote:
James Kanze wrote:
>On 8 mar, 23:09, Ioannis Vranos <ivra...@nospam.no.spamfreemail.gr>
wrote:
>>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?

No. But for integral types, the standard does impose a pure
binary representation, so the minimum value ranges do impose a
minimum number of bits.


Do you mean that all integer types, signed and unsigned, are required to
not have padding bits?
Since the standard does impose a pure binary representation and a
minimal interval of values that the integer should be able to store
there is an implicit requirement on the minimum size (in bits) of the
integer types (the minimal number of bits required to store values in
those intervals).

--
Erik Wikström
Mar 9 '08 #12

P: n/a
On Sun, 09 Mar 2008 14:33:53 +0200, Ioannis Vranos
<iv*****@nospam.no.spamfreemail.grwrote in comp.lang.c++:
James Kanze wrote:
On 8 mar, 23:09, Ioannis Vranos <ivra...@nospam.no.spamfreemail.gr>
wrote:
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?
No. But for integral types, the standard does impose a pure
binary representation, so the minimum value ranges do impose a
minimum number of bits.


Do you mean that all integer types, signed and unsigned, are required to
not have padding bits?
No, that is only true of unsigned char (in C), and all the character
types in C++.

It is also true of the exact-width integer types, if defined, in C99,
not yet but soon to be part of the next C++ standard. They must have
no padding bits and use 2's complement representation for negative
values in the signed types.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Mar 9 '08 #13

P: n/a
On Mar 9, 1:33 pm, Ioannis Vranos <ivra...@nospam.no.spamfreemail.gr>
wrote:
James Kanze wrote:
On 8 mar, 23:09, Ioannis Vranos <ivra...@nospam.no.spamfreemail.gr>
wrote:
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?
No. But for integral types, the standard does impose a pure
binary representation, so the minimum value ranges do impose a
minimum number of bits.
Do you mean that all integer types, signed and unsigned, are
required to not have padding bits?
No, but the value bits must use a binary representation. (The C
standard says explicitly that the negative representation must
be one of 2's complement, 1's complement or signed magnitude.
C++ tries to say more or less the same thing in more general
terms.)

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Mar 10 '08 #14

This discussion thread is closed

Replies have been disabled for this discussion.