473,378 Members | 1,531 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,378 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 2692
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...
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...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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?

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.