Re: Man page pre & post operators error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Rick,

On 9/20/19 4:19 PM, Rick Stanley wrote:
> Greetings!
> 
> In the man pages, both in Linux and online in multiple sites, the pre
> and post operators are listed as equal precedence.  Two different web
> sites list them on different levels:
> 
> http://man7.org/linux/man-pages/man7/precedence.7.html
> 	Level 1
> 
> https://linux.die.net/man/7/operator
> 	Level 2
> 
> Linux `man operator` list them on the second level, with right to left
> associativity:
> 
>        Operator                            Associativity
>        () [] -> .                          left to right
>        ! ~ ++ -- + - (type) * & sizeof     right to left
>        ...
> 
> Section "A.2.1 Expressions" of both the C99 & C11 C Draft Standards,
> list them on different levels:
> 
> 	postfix ++ & -- on level 1, with left to right associativity
> 
> 	prefix ++ & -- on level 2, with right to left associativity

So, Harbison & Steele also seems to agree here. Things changed since
K&R! I've fixed the page:

       Operator                            Associativity   Notes
       () [] -> . ++ --                    left to right   [1]
       ! ~ ++ -- + - (type) * & sizeof     right to left   [2]
       [...]

       The following notes provide further information to the  above  ta‐
       ble:

       [1] The ++ and -- operators at this precedence level are the post‐
           fix flavors of the operators.
       [2] The ++ and -- operators at this precedence level are the  pre‐
           fix flavors of the operators.

> Please review this and all the operator precedence and associativity in
> the current man page "man operator" against the official C99 & C11
> Standards documents, plus the current working draft for the next
> version of the Standard.

You are free to do so. But please don't demand that someone else
does so, even if you say "please".

Thank you for the bug report!

Cheers,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux