I have no idea. Your code is identical to CBFalconer's code except
that you split the lines.
My point exactly. In that case I would probably do pretty much as he did.
You've objected to using an assignment as a
condition; now you post code that does exactly that.
Mo I have not. You misunderstand.
I grumbled about using the same symbols for differing purposes. I get why
it was done... they ran out of punctuation. But the problem is that it was,
I think, poorly thought out... It would have been FAR clearer and a lot
easier to get one's head around if they'd played by some set of rules. Like
I said, single characters are assignments and double characters are tests.
It would sit much more clearly in a person's mind than the "Except for this,
that is true" setup currently in use.
I have no problem with the code you just posted; it just seems to
contradict what you've been saying.
I can see where you might think that... but look more closely at what I've
been saying. I've been trying to make a point about consistent rules within
the language.
Assignment ... =, &, |, <, >, %
Testing ... ==, &&, ||, <<, >>, %%
(or visa versa)
Ok I get that it's not that way and I've no problem working with it as it
is. I do, afterall, like C just fine. I'm simply pointing out how
confusing it is for someone who's just learning. If there was a rule, it
would help.
My point that allowing assignments inside a comparison should flag a syntax
error was that, were it so, it's likely 4/5ths of the mistakes I made while
learning would have been caught by the compiler. And there are, afteral,
ways around using assignments inside conditionals.
The original examples (for example) could easily be broken into two
statements with the same result...
err = function()
if (err)
...
So it's not like it would have crippled programmers to do it.
But... they didn't do it that way, it is what it is and this whole
discussion is getting a little silly.