operator.7: Prefix and postfix ++/-- have different precedences

Harbison and Steele also agree on this.

Reported-by: Rick Stanley <rstanley@rsiny.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2019-09-22 22:58:45 +02:00
parent e5f5563cba
commit cc245e5bf8
1 changed files with 16 additions and 5 deletions

View File

@ -44,11 +44,11 @@ operator \- C operator precedence and order of evaluation
This manual page lists C operators and their precedence in evaluation.
.PP
.TS
lb lb
l l.
Operator Associativity
() [] \-> . left to right
! ~ ++ \-\- + \- (type) * & sizeof right to left
lb lb lb
l l l.
Operator Associativity Notes
() [] \-> . ++ \-\- left to right [1]
! ~ ++ \-\- + \- (type) * & sizeof right to left [2]
* / % left to right
+ \- left to right
<< >> left to right
@ -63,3 +63,14 @@ Operator Associativity
= += \-= *= /= %= <<= >>= &= ^= |= right to left
, left to right
.TE
.PP
The following notes provide further information to the above table:
.PP
.PD 0
.IP [1] 4
The ++ and \-\- operators at this precedence level are
the postfix flavors of the operators.
.IP [2]
The ++ and \-\- operators at this precedence level are
the prefix flavors of the operators.
.PD