473,788 Members | 2,896 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FAQ issue: Guaranteed value ranges of fundamental types?

The C++ FAQ item 29.5 (this seems to be strongly related to C), at
<url: http://www.parashift.c om/c++-faq-lite/newbie.html#faq-29.5>
mentions that

<quote>
C++ guarantees a char is exactly one byte which is at least 8 bits, short
is at least 16 bits, int is at least 16 bits, and long is at least 32
bits.
</quote>
Questions:

(1) This guarantee seems to come from the C standard. Which I don't
have. Does the C++ standard really guarantee this?

(2) Is this guarantee originally formulated in terms of number of bits,
or in terms of e.g. decimal value ranges?

(3) Concerning (2), if formulated in terms of number of bits, are the number
of bits mentioned simply sizeof(T)*CHAR_ BIT, which doesn't say much about
value ranges, or are they stated to be the value representation bits?
(Intentionally cross-posted [comp.lang.c++] and [comp.lang.c]).

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 23 '05
30 1590
* Jack Klein:
But whether the C++ standard decided to incorporate the C standard in
its entirety, which it does not, or decided to only incorporate the
third comma on page 47, which it also does not, it not a C language
issue or topical for comp.lang.c at all.


That is literally true but irrelevant.

The main concerns only the C standard. You think the C standard is off-topic
in [clc]? That something else is also mentioned is irrelevant for topicality.

See <url: http://www.nizkor.org/features/fallacies/red-herring.html> and
<url: http://www.nizkor.org/features/fallacies/straw-man.html> (good
idea to study the other fallacies, too :-)

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 23 '05 #21
Mark McIntyre wrote:

On Sat, 5 Feb 2005 20:30:18 +0000 (UTC), in comp.lang.c , infobahn
<in******@btint ernet.com> wrote:
Victor Bazarov wrote:

I wonder what _exactly_ does your copy say in 3.9.1/1 that makes you
derive that 'char <= short <= int'. But that doesn't matter. You are
actually correct, the C standard defined those relationships between
type sizes.


C&V please.


5.2.4.2.1 Sizes of Integral types.


That section talks about value ranges. Victor Barazov claimed that the
Standard defined those relationships between type *sizes*. That is, he
seemed to mean, for example, that sizeof(short) is guaranteed to be <=
sizeof(int). I can see nothing in 5.2.4.2.1 that requires this. Please
be more explicit. Thank you.
Jul 23 '05 #22
On Sun, 06 Feb 2005 14:19:58 GMT, in comp.lang.c , al***@start.no (Alf P.
Steinbach) wrote:
Before posting such remarks, you might want to check up on my
credentials, posting history etc.


I could do, but I wasn't the one making a fool of myself.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt >

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 23 '05 #23
On Sun, 6 Feb 2005 16:10:19 +0000 (UTC), in comp.lang.c , infobahn
<in******@btint ernet.com> wrote:
Mark McIntyre wrote:

5.2.4.2.1 Sizes of Integral types.
That section talks about value ranges.


Yes
Victor Barazov claimed that the
Standard defined those relationships between type *sizes*.
Yes.
That is, he
seemed to mean, for example, that sizeof(short) is guaranteed to be <=
sizeof(int). I can see nothing in 5.2.4.2.1 that requires this. Please
be more explicit. Thank you.


*shrug*. Only a pedant would argue about the difference. I know, CLC is
full of 'em. SIL.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt >

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 23 '05 #24
* Mark McIntyre:
* Alf P. Steinbach:


[reinserted]
* Mark McIntyre:
Before posting such remarks, you might want to check up on Jack's
credentials, posting history etc.
[/reinserted]
Before posting such remarks, you might want to check up on my
credentials, posting history etc.


I could do, but I wasn't the one making a fool of myself.


Don't engage in ad hominem attacks, don't misquote other people or quote them
out of context, follow your own advice, and you may become a happy person. :-)

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Jul 23 '05 #25
Mark McIntyre wrote:

On Sun, 6 Feb 2005 16:10:19 +0000 (UTC), in comp.lang.c , infobahn
<in******@btint ernet.com> wrote:
That is, he
seemed to mean, for example, that sizeof(short) is guaranteed to be <=
sizeof(int). I can see nothing in 5.2.4.2.1 that requires this. Please
be more explicit. Thank you.


*shrug*. Only a pedant would argue about the difference. I know, CLC is
full of 'em. SIL.


There's right, and there's wrong, and there's a grey area. The
original claim was slap bang in the middle of the "wrong", and
there's nothing "pedantic" about saying so. But, even if there
is, I'd rather be pedantic than wrong.
Jul 23 '05 #26
Mark McIntyre wrote:
*shrug*. Only a pedant would argue about the difference. I know, CLC is
full of 'em. SIL.


What is "SIL"?
Jul 23 '05 #27
Julie wrote:
Mark McIntyre wrote:
*shrug*. Only a pedant would argue about the difference. I know, CLC is
full of 'em. SIL.


What is "SIL"?


Presumably, "such is life".
Cheers
Michael
--
E-Mail: Mine is a gmx dot de address.

Jul 23 '05 #28
On Tue, 08 Feb 2005 08:22:25 -0800, in comp.lang.c , Julie
<ju***@nospam.c om> wrote:
Mark McIntyre wrote:
*shrug*. Only a pedant would argue about the difference. I know, CLC is
full of 'em. SIL.


What is "SIL"?


Such Is Life.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt >

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 23 '05 #29
On Tue, 08 Feb 2005 00:01:15 GMT, in comp.lang.c , al***@start.no (Alf P.
Steinbach) wrote:
Don't engage in ad hominem attacks, don't misquote other people or quote them
out of context,
I did none of these things, but you did. Physician, heal thyself.
follow your own advice, and you may become a happy person. :-)


I'm already happy thanks.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt >

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Jul 23 '05 #30

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

Similar topics

15
5963
by: Ladvánszky Károly | last post by:
Entering 3.4 in Python yields 3.3999999999999999. I know it is due to the fact that 3.4 can not be precisely expressed by the powers of 2. Can the float handling rules of the underlying layers be set from Python so that 3.4 yield 3.4? Thanks, Károly
8
1803
by: Kyle Kolander | last post by:
Sorry, I sent this to comp.std.c++ and meant to send it here as well... Why are the minimum size guarantees for fundamental types intentionally omitted from section 3.9.1 Fundamental types of the C++ standard? If indeed these guarantees can be inferred from other parts of the standard, and it is the intent of the standards committee that these guarantees exist, then why are they not listed in the most relevant section? I've been...
2
1724
by: Ben O'Steen | last post by:
Scenario: ========= Using PyGame in particular, I am trying to write an application that will run a scripted timeline of events, eg at 5.5 seconds, play xxx.mp3 and put the image of a ball on screen, at 7.8 seconds move the ball up and down. At this point, I hear you say 'Oh, like Flash'. Yes, well... Like Flash, but I don't want to take this app in the same direction as Macromedia took Flash, nor do I (ever) want the two to be
30
1411
by: Alf P. Steinbach | last post by:
The C++ FAQ item 29.5 (this seems to be strongly related to C), at <url: http://www.parashift.com/c++-faq-lite/newbie.html#faq-29.5> mentions that <quote> C++ guarantees a char is exactly one byte which is at least 8 bits, short is at least 16 bits, int is at least 16 bits, and long is at least 32 bits. </quote>
18
2381
by: ranjeet.gupta | last post by:
Dear ALL As we know that when we declare the union then we have the size of the union which is the size of the highest data type as in the below case the size should be 4 (For my case and compiler), and it is, what I conclude from the below code union data_type {
22
27077
by: subramanian100in | last post by:
Consider the following program #include <limits.h> #include <stddef.h> int main(void) { size_t size; size_t bytes = sizeof(size_t);
14
2411
by: n3o | last post by:
Hello Comp.Lang.C Members, I have an issue with user input that I have been trying to figure out for the longest. For instance, let's say you have something like this: void foo() { int num; printf("Please enter a number: "); scanf("%d", &num); // yes I know this function may throw a
1
1455
by: jehugaleahsa | last post by:
Hello: I am experiencing performance related issues when my custom data structures work with value types. I use generics to prevent boxing wherever I can. For instance, I use IEqualityComparer, etc. I have gone through most of my data structures and verified that I don't compare to null or call methods that would box my value types. However, I am still experiencing performance problems. I can process strings faster than I can process...
0
9656
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10172
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
9967
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
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
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
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
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
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.