
26 Apr
2011
26 Apr
'11
10:03 p.m.
Hey, On Fri, Apr 22, 2011 at 05:36:25PM -0600, Eric Blake wrote:
That evaluates ptr twice. We can do better, by exploiting that the ternary operator can be used to determine the type of an expression without evaluating it. Gcc allows 1?(void*)expr:pointer (the resulting type is void*), but hates 1?(void*)expr:int (promoting to int provokes a warning):
cc1: warnings being treated as errors remote.c: In function 'remoteDispatchListNetworks': remote.c:3684:70: error: pointer/integer type mismatch in conditional expression
So how about:
Sorry for the late answer, but this looks good to me too. Let's hope gcc doesn't get too clever and never stops warning about this. Thanks, Christophe