>if(a=f(x))g();
I don't see why you would need to store the value of f(x) in "a" on this one, and I don't think that "back in the day" they just couldn't write if( f(x) ) g();
In the example, it is assumed that you have to store a to reuse the value elsewhere. Something you still see today while it doesn't fit the assignment=condition is while ((c=fgetc(file))!=EOF) in hand-written parsers and the like. You are going to need the value in c in the loop and calling the function again won't work.
>In the example, it is assumed that you have to store a to reuse the value elsewhere.
a=f(x); if(a) g();
And then you actually can reuse "a" elsewhere
that's using two extra characters and a readability whitespace not counting the new line. :p
In c, you can reuse "a" in both cases.
(post is archived)