From: chet.ramey@case.edu (Chet Ramey)
Subject: [TUHS] C question for the historians
Date: Wed, 8 Nov 2017 20:41:51 -0500 [thread overview]
Message-ID: <e6fafaac-7b27-601a-c105-d5286668fa00@case.edu> (raw)
In-Reply-To: <20171109012207.BA4111F942@orac.inputplus.co.uk>
On 11/8/17 8:22 PM, Ralph Corderoy wrote:
> Hi Chet,
>
>>> But this w & MASK discussion is one of the weirder ones.
>>
>> gcc warns about it in its default mode
>
> I'm having trouble triggering that, though often these things crop up
> when you don't want them, not when you do.
>
> $ cat t.c
> #define M 0xa5
>
> int foo(int i, int j)
> {
> if (i & M && j & ~M)
> return 42;
> return -314;
> }
> $ gcc -Wall -pedantic`: swine` -O3 -c t.c
> $
>
> When it does moan, is it one of those things where just extra
> parenthesis suffice as a signal that you meant it?
Yeah, that's what I thought, but I didn't go so far as to test it.
(There's also the annoying warning on `if (x = something)'; maybe that's
what I was thinking.)
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet at case.edu http://cnswww.cns.cwru.edu/~chet/
next prev parent reply other threads:[~2017-11-09 1:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-08 16:17 Arthur Krewat
2017-11-08 16:27 ` Warner Losh
2017-11-09 10:17 ` Michael Kjörling
2017-11-08 18:14 ` Ralph Corderoy
2017-11-08 18:34 ` Arthur Krewat
2017-11-08 19:05 ` Larry McVoy
2017-11-08 20:13 ` ron minnich
2017-11-08 20:23 ` Larry McVoy
2017-11-08 20:32 ` Ron Natalie
2017-11-08 20:39 ` Warner Losh
2017-11-08 20:41 ` Chet Ramey
2017-11-09 1:22 ` Ralph Corderoy
2017-11-09 1:41 ` Chet Ramey [this message]
2017-11-09 1:49 ` Arthur Krewat
2017-11-08 20:43 ` Bakul Shah
2017-11-08 20:55 ` Steve Nickolas
2017-11-08 20:36 ` Warner Losh
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=e6fafaac-7b27-601a-c105-d5286668fa00@case.edu \
--to=chet.ramey@case.edu \
/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 NNTP newsgroup(s).