FWD: lijh8@xxxxxx: about operator(7) precedence

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

 



Hi,

Forwarding to the mailing list as plain text.

I'll reply to this mail in a moment.  For now, let me ask what
</usr/share/misc/operator> contains in macOS; I'm curious.

Have a lovely day,
Alex

----- Forwarded message from lijh8 <lijh8@xxxxxx> -----

Date: Sat, 20 Jan 2024 05:20:40 +0800
From: lijh8 <lijh8@xxxxxx>
To: alx <alx@xxxxxxxxxx>
Cc: linux-man <linux-man@xxxxxxxxxxxxxxx>
Subject: about operator(7) precedence
Message-ID: <tencent_98F329827330C28C2727E9F2106379868609@xxxxxx>
X-Mailer: QQMail 2.x

Hi, on macOS (and maybe freeBSD), postfix and prefix ++ -- are the same 
precedence and can be distinguished by associativities.


Why on linux, postfix and prefix are divided into two different 
precedences? What's the reason, is the C language changed?


---


```


OPERATOR(7)             Miscellaneous Information Manual            OPERATOR(7)


NAME
     operator – C operator precedence and order of evaluation


DESCRIPTION
           Operator                        Associativity
           --------                        -------------
           () [] -> .                      left to right
           ! ~ ++ -- - (type) * & sizeof   right to left
           * / %                           left to right
           + -                             left to right
           << >>                           left to right
           < <= > >=                       left to right
           == !=                           left to right
           &                               left to right
           ^                               left to right
           |                               left to right
           &&                              left to right
           ||                              left to right
           ?:                              right to left
           = += -= etc.                    right to left
           ,                               left to right


FILES
     /usr/share/misc/operator


macOS 12.7                        June 9, 1993                       macOS 12.7


```


---


```


operator(7)            Miscellaneous Information Manual           operator(7)


NAME
       operator - C operator precedence and order of evaluation


DESCRIPTION
       This manual page lists C operators and their precedence in evaluation.


       Operator                            Associativity   Notes
       [] () . -> ++ --                    left to right   [1]
       ++ -- & * + - ~ ! sizeof            right to left   [2]
       (type)                              right to left
       * / %                               left to right
       + -                                 left to right
       << >>                               left to right
       < > <= >=                           left to right
       == !=                               left to right
       &                                   left to right
       ^                                   left to right
       |                                   left to right
       &&                                  left to right
       ||                                  left to right
       ?:                                  right to left
       = *= /= %= += -= <<= >>= &= ^= |=   right to left
       ,                                   left to right


       The following notes provide further information to the above table:


       [1] The  ++  and -- operators at this precedence level are the postfix
           flavors of the operators.
       [2] The ++ and -- operators at this precedence level  are  the  prefix
           flavors of the operators.


Linux man-pages 6.03              2023-02-05                      operator(7)


```

----- End forwarded message -----

-- 
<https://www.alejandro-colomar.es/>
Looking for a remote C programming job at the moment.

Attachment: signature.asc
Description: PGP signature


[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