Re: correction
"Victor Bazarov" <v.Abazarov@comAcast.net> wrote in news:fcp1sc$bcs$1
@news.datemas.de:
Rolf Magnus wrote:
Victor Bazarov wrote:
Dong Back Kim wrote:
[..]
Very interesting code style "5>=x". I didn't even know it's an
acceptable expression.
Why shouldn't it?
Are you saying you saw it before and thought it was illegal or
what? How could it not be acceptable? It's not what one would
call "common", of course...
I would call it quite common.
Really? Quite common where? Among whom? Obfuscators in an asylum?
I can understand the use of NULL or 0 on the left side of ==, maybe.
But non-symmetrical operator (>=)?... I am yet to see such code
in a production codebase.
V
There's a whole group of folk who try to prevent:
if (a == 5) ...
from accidentally turning into:
if (a = 5)
by requiring that you write the bass ackwards:
if (5 == a)
of course, these same folk then think well... if they can drop the '='
then they can also drop the '>' so lets do those backwards too. Sadly,
they usually don't realize that that same reasoning gets rid of all the
assignment operators as well. (+=, -= *= /= etc) because after all, you
might drop a character.
The whole thing is pretty silly since almost all C++ compilers can be
made to provide a warning for an assignment inside an 'if'. (with VC++
it comes with warning level 4, but you can explicitly turn it on as
well).
Personally, I don't find the embedded assignment any harder to debug
than any other problem you encounter, so I don't see the point.
joe