Skip to content

Commit 891bb18

Browse files
committed
Add link; mention binary operands; accidental overflow to rationale
1 parent 8e7598f commit 891bb18

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

spec/expression.dd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,6 +2068,8 @@ $(H3 $(LNAME2 uniform_construction_syntax, Uniform construction syntax for built
20682068
auto b = wchar(); // same as: wchar.init
20692069
---
20702070

2071+
$(P See also: $(DDSUBLINK spec/type, usual-arithmetic-conversions, Usual Arithmetic Conversions).)
2072+
20712073

20722074
$(H3 $(LNAME2 assert_expressions, Assert Expressions))
20732075

spec/type.dd

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,8 @@ $(H3 $(LEGACY_LNAME2 Integer Promotions, integer-promotions, Integer Promotions)
274274
column.
275275
)
276276

277+
$(P Integer promotion applies to each operand of a binary expression:)
278+
277279
$(SPEC_RUNNABLE_EXAMPLE_COMPILE
278280
---
279281
byte a;
@@ -293,8 +295,11 @@ $(H3 $(LEGACY_LNAME2 Integer Promotions, integer-promotions, Integer Promotions)
293295
---
294296
)
295297

296-
$(RATIONALE 32-bit integer operations are often faster than smaller integers
297-
for single variables on modern architectures.)
298+
$(RATIONALE
299+
* 32-bit integer operations are often faster than smaller integer types
300+
for single variables on modern architectures.
301+
* Promotion helps avoid accidental overflow which is more common with small integer types.
302+
)
298303

299304
$(H3 $(LEGACY_LNAME2 Usual Arithmetic Conversions, usual-arithmetic-conversions, Usual Arithmetic Conversions))
300305

0 commit comments

Comments
 (0)