Files
cppdraft_translate/cppdraft/conv/integral.md
2025-10-25 03:02:53 +03:00

43 lines
1.3 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[conv.integral]
# 7 Expressions [[expr]](./#expr)
## 7.3 Standard conversions [[conv]](conv#integral)
### 7.3.9 Integral conversions [conv.integral]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L942)
A prvalue of an integer type can be converted to a prvalue of another
integer type[.](#1.sentence-1)
A prvalue of an unscoped enumeration type can be converted to
a prvalue of an integer type[.](#1.sentence-2)
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L948)
If the destination type is bool, see [[conv.bool]](conv.bool "7.3.15Boolean conversions")[.](#2.sentence-1)
If the
source type is bool, the value false is converted to
zero and the value true is converted to one[.](#2.sentence-2)
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L954)
Otherwise, the result is the unique value of the destination type
that is congruent to the source integer modulo 2N,
where N is the width of the destination type[.](#3.sentence-1)
[4](#4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/expressions.tex#L961)
The conversions allowed as integral promotions are excluded from the set
of integral conversions[.](#4.sentence-1)