2.6 r7745 warning - Precedence in ADM_aacadts.cpp

Started by nibbles, March 12, 2012, 09:45:48 AM

Previous topic - Next topic

nibbles

Maybe I can help 2.6 a little, if we examine some warnings I get from Clang.  It is excellent at offering advice and analysis.  Here is a good example.  You can see below how Clang has guessed something may be wrong:


/tmp/homebrew-avidemux3-2.6-getv/avidemux_core/ADM_coreAudioParser/src/ADM_aacadts.cpp:138:30: warning: & has lower precedence than ==; == will be evaluated
      first [-Wparentheses]
        if(p[0]==0xff && p[1]&0xf0==0xf0)
                             ^~~~~~~~~~~
/tmp/homebrew-avidemux3-2.6-getv/avidemux_core/ADM_coreAudioParser/src/ADM_aacadts.cpp:138:30: note: place parentheses around the == expression to silence this
      warning
        if(p[0]==0xff && p[1]&0xf0==0xf0)
                             ^
                              (         )
/tmp/homebrew-avidemux3-2.6-getv/avidemux_core/ADM_coreAudioParser/src/ADM_aacadts.cpp:138:30: note: place parentheses around the & expression to evaluate it
      first
        if(p[0]==0xff && p[1]&0xf0==0xf0)
                             ^
                         (        )
1 warning generated.



I do not understand code where (0xf0==0xf0) is the idea.  So did Clang spot a need for ( ) ?
Here is a link to the source code in 2.6_branch_mean

Ok well, that's about how hard it is :-)  I sit there, Clang tells me how to fix stuff.
If this sort of post is useful, let me know.  Thanks.

Agent_007

I would guess it is a TYPO. Or at least I think there is an easier way to to bit comparisions  :)
I am away between 15th of May - 15th of June. (yes, I am playing D3)