On February 7, 2009 2:19:59 AM -0500 Timo Sirainen tss@iki.fi wrote:
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.
Well now, there's lot of code you might see which isn't correct, e.g. the very common #!/bin/sh but the code is actually a bash script.
In this case though, I believe Jack is correct and it is legal. I don't know where I got the idea it was invalid. Well, I do know but I won't embarrass myself further. :)
-frank