[TUHS] C question for the historians

Ralph Corderoy ralph at inputplus.co.uk
Thu Nov 9 11:22:07 AEST 2017


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?

-- 
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy



More information about the TUHS mailing list