Questions tagged [conversion-rank]

Conversion rank is a concept defined by C and C++ Standards in order to describe a way arithmetic conversion is performed.

4 questions
3
votes
1 answer

Conversion rank of extended unsigned integer type

The conversion rank is defined in 6.3.1.1/1: Every integer type has an integer conversion rank defined as follows: — No two signed integer types shall have the same rank, even if they have the same representation. — The rank of a signed integer…
St.Antario
  • 26,175
  • 41
  • 130
  • 318
2
votes
3 answers

Signed integer type and its corresponding unsigned integer type

For each signed integer type the Standard guarantees existence of a corresponding unsigned integer type. 6.2.5 p6: For each of the signed integer types, there is a corresponding (but different) unsigned integer type (designated with the keyword…
St.Antario
  • 26,175
  • 41
  • 130
  • 318
2
votes
1 answer

Comparing ptrdiff_t with size_t

I have a question about the following simple comparison: #define BUF_SIZE //maybe large static char buf[BUF_SIZE]; static char *limit; // some pointer to an element of buf array void foo(){ if(limit - buf <= sizeof buf){ //<---- This…
St.Antario
  • 26,175
  • 41
  • 130
  • 318
0
votes
2 answers

How does type conversion and integer promotion work for stdint.h?

In C, I understand type conversions, integer promotion, casting, etc. for standard types, but how do the stdint.h types factor into this? For type rankings, the rules state: No two signed integer types shall have the same rank, even if they have…
user1801359
  • 422
  • 1
  • 4
  • 14