Menu

#962 shk.c:4733: bad precedence ?

CVS
open
nobody
None
5
2022-04-19
2022-04-19
dcb
No

I just compiled the package with new C compiler clang-14.
It said:

./shk.c:4733:27: warning: & has lower precedence than ==; == will be evaluated first [-Wparentheses]

Source code is

if (ESHK(shkp)->services & (SHK_ID_BASIC|SHK_ID_PREMIUM) ==
        SHK_ID_BASIC|SHK_ID_PREMIUM) {

Maybe better code:

if ((ESHK(shkp)->services & (SHK_ID_BASIC|SHK_ID_PREMIUM)) ==
        SHK_ID_BASIC|SHK_ID_PREMIUM) {

Discussion


Log in to post a comment.

MongoDB Logo MongoDB