From: Alejandro Colomar <alx@kernel.org>
To: linux-man@vger.kernel.org
Cc: lijh8 <lijh8@qq.com>
Subject: FWD: lijh8@qq.com: about operator(7) precedence
Date: Fri, 19 Jan 2024 22:50:19 +0100 [thread overview]
Message-ID: <ZaruodlIbZHnErOK@debian> (raw)
In-Reply-To: <tencent_98F329827330C28C2727E9F2106379868609@qq.com>
[-- Attachment #1: Type: text/plain, Size: 3941 bytes --]
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@qq.com> -----
Date: Sat, 20 Jan 2024 05:20:40 +0800
From: lijh8 <lijh8@qq.com>
To: alx <alx@kernel.org>
Cc: linux-man <linux-man@vger.kernel.org>
Subject: about operator(7) precedence
Message-ID: <tencent_98F329827330C28C2727E9F2106379868609@qq.com>
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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next parent reply other threads:[~2024-01-19 21:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <tencent_98F329827330C28C2727E9F2106379868609@qq.com>
2024-01-19 21:50 ` Alejandro Colomar [this message]
2024-01-19 22:58 ` FWD: lijh8@qq.com: about operator(7) precedence Alejandro Colomar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZaruodlIbZHnErOK@debian \
--to=alx@kernel.org \
--cc=lijh8@qq.com \
--cc=linux-man@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).