Behavior-wise, yes they are equivalent since the member access ->
operator has a higher precedence than the address-of &
operator.
Readibility-wise, the second one &(s->var)
is much more readable than &s->var
and should be preferred over the first form. With the second form, &(s->var)
, you won't have to second-guess what it's actually doing as you know the expression in the parentheses are always evaluated first. When in doubt, use parentheses.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…