tmp/tmp04j6gyby/{from.md → to.md}
RENAMED
|
@@ -1,35 +1,68 @@
|
|
| 1 |
-
###
|
| 2 |
|
| 3 |
Every integer type has an *integer conversion rank* defined as follows:
|
| 4 |
|
| 5 |
- No two signed integer types other than `char` and `signed
|
| 6 |
-
char` (if `char` is signed)
|
| 7 |
-
|
| 8 |
-
- The rank of a signed integer type
|
| 9 |
-
|
| 10 |
-
- The rank of `long long int`
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
- The rank of any unsigned integer type shall equal the rank of the
|
| 15 |
corresponding signed integer type.
|
| 16 |
-
- The rank of any standard integer type
|
| 17 |
-
|
| 18 |
-
- The rank of `char`
|
| 19 |
`unsigned char`.
|
| 20 |
-
- The rank of `bool`
|
| 21 |
-
|
| 22 |
-
- The ranks of `char8_t`, `char16_t`, `char32_t`, and `wchar_t`
|
| 23 |
-
|
| 24 |
- The rank of any extended signed integer type relative to another
|
| 25 |
extended signed integer type with the same width is
|
| 26 |
*implementation-defined*, but still subject to the other rules for
|
| 27 |
determining the integer conversion rank.
|
| 28 |
- For all integer types `T1`, `T2`, and `T3`, if `T1` has greater rank
|
| 29 |
-
than `T2` and `T2` has greater rank than `T3`, then `T1`
|
| 30 |
-
|
| 31 |
|
| 32 |
[*Note 1*: The integer conversion rank is used in the definition of the
|
| 33 |
integral promotions [[conv.prom]] and the usual arithmetic conversions
|
| 34 |
[[expr.arith.conv]]. — *end note*]
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Conversion ranks <a id="conv.rank">[[conv.rank]]</a>
|
| 2 |
|
| 3 |
Every integer type has an *integer conversion rank* defined as follows:
|
| 4 |
|
| 5 |
- No two signed integer types other than `char` and `signed
|
| 6 |
+
char` (if `char` is signed) have the same rank, even if they have the
|
| 7 |
+
same representation.
|
| 8 |
+
- The rank of a signed integer type is greater than the rank of any
|
| 9 |
+
signed integer type with a smaller width.
|
| 10 |
+
- The rank of `long long int` is greater than the rank of `long int`,
|
| 11 |
+
which is greater than the rank of `int`, which is greater than the
|
| 12 |
+
rank of `short int`, which is greater than the rank of `signed char`.
|
| 13 |
+
- The rank of any unsigned integer type equals the rank of the
|
|
|
|
| 14 |
corresponding signed integer type.
|
| 15 |
+
- The rank of any standard integer type is greater than the rank of any
|
| 16 |
+
extended integer type with the same width.
|
| 17 |
+
- The rank of `char` equals the rank of `signed char` and
|
| 18 |
`unsigned char`.
|
| 19 |
+
- The rank of `bool` is less than the rank of all standard integer
|
| 20 |
+
types.
|
| 21 |
+
- The ranks of `char8_t`, `char16_t`, `char32_t`, and `wchar_t` equal
|
| 22 |
+
the ranks of their underlying types [[basic.fundamental]].
|
| 23 |
- The rank of any extended signed integer type relative to another
|
| 24 |
extended signed integer type with the same width is
|
| 25 |
*implementation-defined*, but still subject to the other rules for
|
| 26 |
determining the integer conversion rank.
|
| 27 |
- For all integer types `T1`, `T2`, and `T3`, if `T1` has greater rank
|
| 28 |
+
than `T2` and `T2` has greater rank than `T3`, then `T1` has greater
|
| 29 |
+
rank than `T3`.
|
| 30 |
|
| 31 |
[*Note 1*: The integer conversion rank is used in the definition of the
|
| 32 |
integral promotions [[conv.prom]] and the usual arithmetic conversions
|
| 33 |
[[expr.arith.conv]]. — *end note*]
|
| 34 |
|
| 35 |
+
Every floating-point type has a *floating-point conversion rank* defined
|
| 36 |
+
as follows:
|
| 37 |
+
|
| 38 |
+
- The rank of a floating point type `T` is greater than the rank of any
|
| 39 |
+
floating-point type whose set of values is a proper subset of the set
|
| 40 |
+
of values of `T`.
|
| 41 |
+
- The rank of `long double` is greater than the rank of `double`, which
|
| 42 |
+
is greater than the rank of `float`.
|
| 43 |
+
- Two extended floating-point types with the same set of values have
|
| 44 |
+
equal ranks.
|
| 45 |
+
- An extended floating-point type with the same set of values as exactly
|
| 46 |
+
one cv-unqualified standard floating-point type has a rank equal to
|
| 47 |
+
the rank of that standard floating-point type.
|
| 48 |
+
- An extended floating-point type with the same set of values as more
|
| 49 |
+
than one cv-unqualified standard floating-point type has a rank equal
|
| 50 |
+
to the rank of `double`.
|
| 51 |
+
|
| 52 |
+
[*Note 2*: The conversion ranks of floating-point types `T1` and `T2`
|
| 53 |
+
are unordered if the set of values of `T1` is neither a subset nor a
|
| 54 |
+
superset of the set of values of `T2`. This can happen when one type has
|
| 55 |
+
both a larger range and a lower precision than the other. — *end note*]
|
| 56 |
+
|
| 57 |
+
Floating-point types that have equal floating-point conversion ranks are
|
| 58 |
+
ordered by floating-point conversion subrank. The subrank forms a total
|
| 59 |
+
order among types with equal ranks. The types `std::float16_t`,
|
| 60 |
+
`std::float32_t`, `std::float64_t`, and `std::float128_t`
|
| 61 |
+
[[stdfloat.syn]] have a greater conversion subrank than any standard
|
| 62 |
+
floating-point type with equal conversion rank. Otherwise, the
|
| 63 |
+
conversion subrank order is *implementation-defined*.
|
| 64 |
+
|
| 65 |
+
[*Note 3*: The floating-point conversion rank and subrank are used in
|
| 66 |
+
the definition of the usual arithmetic conversions
|
| 67 |
+
[[expr.arith.conv]]. — *end note*]
|
| 68 |
+
|