From: Neo Liu <diabloneo@gmail.com>
To: SystemTap <systemtap@sourceware.org>
Subject: operator precedence differs from C language
Date: Thu, 01 Apr 2010 02:37:00 -0000 [thread overview]
Message-ID: <p2p861674c01003311936nef74996ckcf3febde43d4e85b@mail.gmail.com> (raw)
I found that the operator precedence of "&" and "==" differed from C
language. Take a look at the following statements.
if ($flags & 07 == 0) { ... }
I thought this statement would first calculate ($flags & 07)
and then calculate (($flags & 07) == 0), but the it is not the case.
It first calculates (07 == 0) and then ($flags & (07 == 0)),
so the result is 0 but not the expected 1. As a solution, I wrote the
statement as:
if (($flags & 07) == 0) { ... }
to get the computing order I want
Is this the stap language feature, or should I report this as a bug?
Thanks!
next reply other threads:[~2010-04-01 2:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-01 2:37 Neo Liu [this message]
2010-04-01 16:29 ` Josh Stone
2010-04-01 17:15 ` Josh Stone
[not found] ` <u2n861674c01004011849o94f1a327za4bc14aff28e3d9@mail.gmail.com>
2010-04-02 2:00 ` Fwd: " Neo Liu
2010-04-01 16:30 ` Frank Ch. Eigler
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=p2p861674c01003311936nef74996ckcf3febde43d4e85b@mail.gmail.com \
--to=diabloneo@gmail.com \
--cc=systemtap@sourceware.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).