7 Feb
2009
7 Feb
'09
9:19 a.m.
On Feb 7, 2009, at 1:47 AM, Frank Cusack wrote:
for (i = j = 0;
removed this warning, and removed my doubts :-)
Should be for (i = (j = 0);
a = b = ... is not legal, although gcc does accept it.
Really? I've seen a=b=c like code for a long time. But I can't say
exactly where C99 would allow that. Anyway I'd think parenthesis only
affect precedence ordering, not whether something is allowed or not.
Although there is one example in C99 spec (well, I've only a draft)
that seems to suggest it's legal:
5.1.2.3 Environment 5.1.2.3
double d1, d2;
float f;
d1 = f = expression;
d2 = (float) expressions;
the values assigned to d1 and d2 are required to have been converted
to float.