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

Std's 6.3- conversion- term rank

Just now I asked a question about signed char and unsigned char. I had the
replay very fast by jens.torring and Tim prince. I post via google so now
goes my thanking replay. (I must be more precise according to jens.torring's
replay)

As I was reading the slandered draft C99 about the conversion (6.3)
I have interpreted the word conversion rank as the range of a variable
(as per defined in limits.h). Am I wrong in my understanding?

(I went through FAQ and I don't find the correct spot)
Nov 14 '05 #1
2 1936
On 25 Jul 2004 09:48:42 -0700, da***********@yahoo.com wrote in
comp.lang.c:
Just now I asked a question about signed char and unsigned char. I had the
replay very fast by jens.torring and Tim prince. I post via google so now
goes my thanking replay. (I must be more precise according to jens.torring's
replay)

As I was reading the slandered draft C99 about the conversion (6.3) ^^^^^^^^^

Slandered?
I have interpreted the word conversion rank as the range of a variable
(as per defined in limits.h). Am I wrong in my understanding?

(I went through FAQ and I don't find the correct spot)


No, the conversion rank has nothing at all to do with the range of a
type.

It specifically says this in the actual standard:

"The rank of 'long long int' shall be greater than the rank of 'long
int', which shall be greater than the rank of 'int', which shall be
greater than the rank of 'short int', which shall be greater than the
rank of 'signed char'."

It cannot be by range of values, because it is quite common for two or
more different integer types to have the same bit-width and value
range on many implementations.

On 16-bit implementations, short and int usually have the same range.

On today's common 32-bit desk-top systems, int and long usually have
the same range.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 14 '05 #2
"Jack Klein" <ja*******@spamcop.net> wrote in message
news:5h********************************@4ax.com...
On 25 Jul 2004 09:48:42 -0700, da***********@yahoo.com wrote in
comp.lang.c:
Just now I asked a question about signed char and unsigned char. I had the replay very fast by jens.torring and Tim prince. I post via google so now goes my thanking replay. (I must be more precise according to jens.torring's replay)

As I was reading the slandered draft C99 about the conversion (6.3) ^^^^^^^^^
Slandered?
I have interpreted the word conversion rank as the range of a variable (as per defined in limits.h). Am I wrong in my understanding?

(I went through FAQ and I don't find the correct spot)


No, the conversion rank has nothing at all to do with the range of a
type.


Nothing at all?!
It specifically says this in the actual standard:

"The rank of 'long long int' shall be greater than the rank of 'long
int', which shall be greater than the rank of 'int', which shall be
greater than the rank of 'short int', which shall be greater than the
rank of 'signed char'."


The sentence before that is...

- The rank of a signed integer type shall be greater than the rank
of any signed integer type with less precision.

Later, 6.2.5p8 says...

For any two integer types with the same signedness and different
integer conversion rank (see 6.3.1.1), the range of values of the
type with smaller integer conversion rank is a subrange of the
values of the other type.

The concepts of range and rank are inextricably linked.

--
Peter
Nov 14 '05 #3

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

Similar topics

7
by: John Ratliff | last post by:
Is this a legitimate (standards compliant) way to check for errors in file I/O. #include <fstream> fstream output("file.ext", std::ios_base::out, std::ios_base::binary); if (output) { //...
6
by: Khuong Dinh Pham | last post by:
How do i read the contents of a xml file and output it to a std::string. Thx in advance
8
by: davihigh | last post by:
My Friends: I am using std::ofstream (as well as ifstream), I hope that when i wrote in some std::string(...) with locale, ofstream can convert to UTF-8 encoding and save file to disk. So does...
2
by: Jan Callewaert | last post by:
Hi, since I want to specify an extra function for a std::valarray<float>, I want to subclass it: class FVector : public std::valarray<float> { public: FVector() : std::valarray<float>() {}...
5
by: sean345 | last post by:
While compiling my program I get the following g++ error: error: no matching function for call to `ErrorLog::file_error(std::string&, std::string&, const char)' note: candidates are: void...
5
by: Pradeep | last post by:
Hi All, I am facing some problem using istream_iterator for reading the contents of a file and copying it in a vector of strings.However the same thing works for a vector of integers. The...
3
by: Kevin Frey | last post by:
I am porting Managed C++ code from VS2003 to VS2005. Therefore adopting the new C++/CLI syntax rather than /clr:oldSyntax. Much of our managed code is concerned with interfacing to native C++...
1
by: Dancefire | last post by:
Hi, everyone, I'm trying to use std::codecvt<to do the encoding conversion. I am using following code for encoding conversion between wchar_t string and char string(MBCS). I am not sure am I...
5
by: aaragon | last post by:
Hi everyone, I wrote a very simple function to try to understand the casting of variables in C++. The function is function foo() { std::vector<inttest(100); randomize(test); unsigned long...
27
by: mike3 | last post by:
Hi. I can't believe I may have to use an array here. I've got this bignum package I was making in C++ for a fractal generator, and tried an approach that was suggested to me here a while...
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...

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.