473,385 Members | 1,907 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,385 software developers and data experts.

Minimum sizes of integral and floating point types

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
13 2697
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
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
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
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
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Adam H. Peterson | last post by:
Is there a standard way to find the minimum value for a data type? I'm thinking along the lines of std::numeric_limits<T>::min(). But that doesn't work for floating point types. I can't use...
14
by: Mike Hewson | last post by:
Have been researching as to why: <example 1> class ABC { static const float some_float = 3.3f; }; <end example 1>
16
by: TTroy | last post by:
Hello, I'm relatively new to C and have gone through more than 4 books on it. None mentioned anything about integral promotion, arithmetic conversion, value preserving and unsigned preserving. ...
8
by: Ioannis Vranos | last post by:
About C95. Is there any mentioning in the standard about the number of usable bits of the various built in types, apart from char/signed char/unsigned char types? Or only about the minimum value...
2
by: James Harris | last post by:
I'm trying to make sense of the standard C data sizes for floating point numbers. I guess the standards were written to accommodate some particular floating point engines that were popular at one...
2
by: Mihai Rusu | last post by:
Hello I am trying to figure out if the standard allows integral type representations with padding (ie value representation != object representation). A conforming implementation can have: - a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.