Re: Error in 'man operator'

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

 



Hi,

On 8/27/21 8:11 PM, David Sletten wrote:
Hi,

I've run across what I believe is a minor error in the man page for C operators (https://man7.org/linux/man-pages/man7/operator.7.html ).

The man page lists casting in the 2nd row of the table:

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

However, in "C A Reference Manual" (5th ed.), table 7-3 on pg. 205 shows that all of the operators in row 2 above have a precedence of 15 except for casts which have a precedence of 14. Consequently, the man page should display casts as the (new) 3rd row in the table above.

Thanks for your effort in maintaining this documentation.


Reviewing the standard (C18), "C A Reference Manual" seems to be right. Unary operators are mentioned in C18::6.5.3, and casts are in C18::6.5.4 (they are mentioned in order of precedence).

I also noticed that we're missing compound literals in the first row. And we're also missing _Alignof() in the second row.
However, since all of those use parentheses (and braces),
there's no doubt in their precedence, so I'll ignore them for now.

And for some reason they are in a different order from the one in the standard, which makes it a bit difficult to correlate what is in the manual page and what is in the standard, so I think reordering them inside the rows will also be an improvement.

Thanks,

Alex


--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/



[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