473,569 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1951
On 25 Jul 2004 09:48:42 -0700, da***********@y ahoo.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.l earn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 14 '05 #2
"Jack Klein" <ja*******@spam cop.net> wrote in message
news:5h******** *************** *********@4ax.c om...
On 25 Jul 2004 09:48:42 -0700, da***********@y ahoo.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
10037
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) { // we're good to write to file.ext in binary mode
6
6597
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
14282
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 ifstream. Something I found shows that, I need to have a proper codecvt to set it. I need more information, maybe a small piece of code sample....
2
2396
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>() {} FVector(size_t size) : std::valarray<float>(size) {} FVector(const FVector & other) : std::valarray<float>(other) {}
5
5412
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 ErrorLog::file_error(const std::string&, int, const std::string&) The error line is: log.file_error(filename, line, "variable is not assigned a value");
5
2814
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 code that doesn't work is std::vector<std::stringvecStr; std::ifstream fstrRead("Test.txt");
3
9517
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++ code (ie. wrappers etc). In Managed C++ there was an automatic conversion between const char* and String^. This was useful to us for two reasons: 1....
1
3649
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 right. The code works, but I'm not familiar with the codecvt, and I don't know my way is the right way to do the job. Could you help me to review the...
5
2524
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 x = 0;
27
2320
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 back, about using a "stack of vectors" instead of a static array. Anyway, I put the suggestion into effect, and it seems the routine that uses the...
0
7612
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...
0
8119
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...
0
6281
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5509
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5218
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...
0
3653
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...
1
2111
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
1
1209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
936
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...

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.