Am 05.03.2010 11:25, MacArthur, Ian (SELEX GALILEO, UK) wrote:
>
>>>> What follow is the output from the compiler and some
>> possible solutions
>>>> (at least when I could guess what is intended), I invite anyone to
>>>> exercise his/her knowledge of c++ and try find what should be done:
>>>>
>>>> Adjuster.cxx: In member function 'virtual void
>> fltk::Adjuster::draw()':
>>>> Adjuster.cxx:83: warning: suggest parentheses around arithmetic in
>>>> operand of '|'
>>>>
>>>> !!!!!!!!!!!! what's intended here !!!!!!!!!!!!!!!
>>>> from: Flags flags = this->flags()&
>> ~(STATE|PUSHED|HIGHLIGHT) | OUTPUT;
>>>> to: Flags flags = this->flags()&  ( (~(STATE|PUSHED|HIGHLIGHT)) |
>>>> OUTPUT );
>
>
> I doubt it.

Sure.  I hope you didn't get the impression that I wrote this from
Domingo's useless partial posting here in fltk.general. :-(

He cut off my reply in fltk.development.

> As you surely know, the "&" operator takes precedence over the "|"
> operator in C, so I would imagine that the original line maps to:
>
>     Flags flags = (this->flags()&  ~(STATE|PUSHED|HIGHLIGHT)) | OUTPUT;
>
> Which makes more sense, if you think about what is being done there,
> does it not?

Yep. Or ...

Flags flags = ((this->flags()&(~(STATE|PUSHED|HIGHLIGHT)))|OUTPUT);

... to make it _absolutely_ clear. ((((useless spaces removed
intentionally))))  ;-P

Albrecht
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to