c - Extra parentheses near arrow operator -
a program i'm trying decode includes following line:
#define nn(sp) ((sp)->nn)
from context (not shown), i'm pretty sure 'sp' pointer struct contains 'nn' 1 of variables.
in expression "((sp)->nn)", inner set of parentheses serve conceivable purpose? if not, might outer set of parentheses serve no purpose?
#define nn(sp) ((sp)->nn)
the inner parentheses required. if pass pointer p + 10
or *p
nn
macro, troubles without inner parentheses ->
has higher precedence +
, unary *
.
the outer parentheses not required here expression involves postfix operation , no operator has greater precedence postfix operators.
Comments
Post a Comment