enet
enet copied to clipboard
Overzealous parenthesis
During my build with clang, a few innocuous warnings popped up:
enet/peer.c:227:59: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((((& peer -> dispatchedCommands) -> sentinel.next) == (& (& peer -> dispatchedCommands) -> sentinel)))
enet/protocol.c:92:67: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((((& peer -> dispatchedCommands) -> sentinel.next) == (& (& peer -> dispatchedCommands) -> sentinel)))
enet/protocol.c:264:62: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((((& peer -> sentReliableCommands) -> sentinel.next) == (& (& peer -> sentReliableCommands) -> sentinel)))
enet/protocol.c:1546:65: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
if ((((& peer -> sentReliableCommands) -> sentinel.next) == (& (& peer -> sentReliableCommands) -> sentinel)))
Nothing critical, but I like keeping the warnings as low as possible (if any at all) :)
I think they're necessary for keeping readability in the face of putting spaces around the ->
operator. :-P
Anyway, seems to me like you'll just want to disable that warning for enet code.
I beg to differ, extra parens here are not the ones you think :)
if ((((& peer -> sentReliableCommands) -> sentinel.next) == (& (& peer -> sentReliableCommands) -> sentinel)))
/* is equivalent to */
if ( ((& peer -> sentReliableCommands) -> sentinel.next) == (& (& peer -> sentReliableCommands) -> sentinel) )
// This is
if ((expr)) /* vs */ if (expr)
So there's no argument about readability here :) And I like my warnings turned on :-$
Heh, alright that's just strange. :)