Re: Which has higher precedence & or ==
- From: "George Hester" <hesterloli@xxxxxxxxxxx>
- Date: Sun, 17 Apr 2005 02:31:38 -0400
Unfortunately I do have to worry about it. That's what Petzold wrote. And I'm trying to fix it.
--
George Hester
_________________________________
"Carl Daniel [VC++ MVP]" <cpdaniel_remove_this_and_nospam@xxxxxxxxxxxxxxx> wrote in message news:uuoiDGxQFHA.1396@xxxxxxxxxxxxxxxxxxxxxxx
> George Hester wrote:
> > I have this example in a window procedure:
> > fBlocking is BOOL and wParam is an argument of the window procedure.
> >
> > switch (iMsg){
> > //
> > case WM_CHAR:
> > if (fBlocking & wParam == '\x1B'){
> > //
> > }
> > retrurn 0;
> > //
> > }
> >
> > Like this we get a warning:
> >
> > warning C4554: '&' : check operator precedence for possible error;
> > use parentheses to clarify precedence
> >
> > But I don't know what the precedence was expected here to put the
> > parens in correctly.
> > Any ideas?
>
> Add parentheses to make it mean what you wanted it to mean - don't worry too
> much about what it means without parentheses.
>
> There's no table of operator precedence in the C++ standard, but the 17
> levels of precedence can be deduced from the grammar. To make a long story
> short, == has higher precedence than &, so your expression almost certainly
> doesn't mean what you wanted without parentheses.
>
> -cd
>
>
>
>
.
- Follow-Ups:
- Re: Which has higher precedence & or ==
- From: Doug Harrison [MVP]
- Re: Which has higher precedence & or ==
- References:
- Which has higher precedence & or ==
- From: George Hester
- Re: Which has higher precedence & or ==
- From: Carl Daniel [VC++ MVP]
- Which has higher precedence & or ==
- Prev by Date: Re: Mouse hooks
- Next by Date: Re: Which has higher precedence & or ==
- Previous by thread: Re: Which has higher precedence & or ==
- Next by thread: Re: Which has higher precedence & or ==
- Index(es):
Relevant Pages
|