Skip to content

Commit 1954824

Browse files
authored
Merge pull request #2228 from WalterBright/integer-promotions
add links for Integer Promotions and Usual Arithmetic Conversions merged-on-behalf-of: Petar Kirov <ZombineDev@users.noreply.github.com>
2 parents 5165562 + 1965850 commit 1954824

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

spec/expression.dd

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ $(H3 $(LNAME2 assignment_operator_expressions, Assignment Operator Expressions))
124124
$(UL
125125
$(LI operand $(D a) is only evaluated once,)
126126
$(LI overloading $(I op) uses a different function than overloading $(I op)= does, and)
127-
$(LI the left operand of $(D >>>=) does not undergo integral promotions before shifting.)
127+
$(LI the left operand of $(D >>>=) does not undergo $(INTEGER_PROMOTIONS) before shifting.)
128128
)
129129

130130
$(P For user-defined types, assignment operator expressions are overloaded separately from
@@ -216,7 +216,7 @@ $(H2 $(LNAME2 bitwise_expressions, Bitwise Expressions))
216216

217217
$(P Bit wise expressions perform a bitwise operation on their operands.
218218
Their operands must be integral types.
219-
First, the default integral promotions are done. Then, the bitwise
219+
First, the $(USUAL_ARITHMETIC_CONVERSIONS) are done. Then, the bitwise
220220
operation is done.
221221
)
222222

@@ -272,7 +272,7 @@ $(GNAME EqualExpression):
272272
$(P Equality expressions compare the two operands for equality ($(D ==))
273273
or inequality ($(D !=)).
274274
The type of the result is $(D bool). The operands
275-
go through the usual conversions to bring them to a common type before
275+
undergo the $(USUAL_ARITHMETIC_CONVERSIONS) to bring them to a common type before
276276
comparison.
277277
)
278278

@@ -345,7 +345,7 @@ $(GNAME IdentityExpression):
345345
$(P The $(D is) compares for identity.
346346
To compare for nonidentity, use $(D e1 !is e2).
347347
The type of the result is $(D bool). The operands
348-
go through the usual conversions to bring them to a common type before
348+
undergo the $(USUAL_ARITHMETIC_CONVERSIONS) to bring them to a common type before
349349
comparison.
350350
)
351351

@@ -379,7 +379,7 @@ $(GNAME RelExpression):
379379
$(GLINK ShiftExpression) $(D >=) $(GLINK ShiftExpression)
380380
)
381381

382-
$(P First, the integral promotions are done on the operands.
382+
$(P First, the $(USUAL_ARITHMETIC_CONVERSIONS) are done on the operands.
383383
The result type of a relational expression is $(D bool).
384384
)
385385

@@ -495,8 +495,8 @@ $(GNAME ShiftExpression):
495495
$(I ShiftExpression) $(D >)$(D >)$(D >) $(GLINK AddExpression)
496496
)
497497

498-
$(P The operands must be integral types, and undergo the usual integral
499-
promotions. The result type is the type of the left operand after
498+
$(P The operands must be integral types, and undergo the $(USUAL_ARITHMETIC_CONVERSIONS).
499+
The result type is the type of the left operand after
500500
the promotions. The result value is the result of shifting the bits
501501
by the right operand's value.
502502
)
@@ -524,14 +524,14 @@ $(GNAME AddExpression):
524524
$(GLINK CatExpression)
525525
)
526526

527-
$(P If the operands are of integral types, they undergo integral
528-
promotions, and then are brought to a common type using the
529-
usual arithmetic conversions.
527+
$(P If the operands are of integral types, they undergo the $(USUAL_ARITHMETIC_CONVERSIONS),
528+
and then are brought to a common type using the
529+
$(USUAL_ARITHMETIC_CONVERSIONS).
530530
)
531531

532532
$(P If either operand is a floating point type, the other is implicitly
533533
converted to floating point and they are brought to a common type
534-
via the usual arithmetic conversions.
534+
via the $(USUAL_ARITHMETIC_CONVERSIONS).
535535
)
536536

537537
$(P If the operator is $(D +) or $(D -), and
@@ -591,9 +591,8 @@ $(GNAME MulExpression):
591591
$(I MulExpression) $(D %) $(GLINK UnaryExpression)
592592
)
593593

594-
$(P The operands must be arithmetic types. They undergo integral
595-
promotions, and then are brought to a common type using the
596-
usual arithmetic conversions.
594+
$(P The operands must be arithmetic types.
595+
They undergo the $(USUAL_ARITHMETIC_CONVERSIONS).
597596
)
598597

599598
$(P For integral operands, the $(D *), $(D /), and $(D %)
@@ -647,7 +646,7 @@ $(GNAME ComplementExpression):
647646
All the bits in the value are complemented.
648647
)
649648

650-
$(P $(B Note:) the usual integral promotions are not performed
649+
$(P $(B Note:) the usual $(INTEGER_PROMOTIONS) are not performed
651650
prior to the complement operation.
652651
)
653652

@@ -2173,4 +2172,6 @@ Macros:
21732172
CHAPTER=10
21742173
TITLE=Expressions
21752174
IDENTIFIER=$(GLINK2 lex, Identifier)
2175+
USUAL_ARITHMETIC_CONVERSIONS=$(DDSUBLINK spec/type, usual-arithmetic-conversions, Usual Arithmetic Conversions)
2176+
INTEGER_PROMOTIONS=$(DDSUBLINK spec/type, integer-promotions, Integer Promotions)
21762177
_=

0 commit comments

Comments
 (0)