E
Elementary Penguin
Shouldn't I be able to do this:
if(1) ++count;
it seems really a pain to have to do
if(1==1) ++count;
if(1) ++count;
it seems really a pain to have to do
if(1==1) ++count;
Elementary said:Shouldn't I be able to do this:
if(1) ++count;
it seems really a pain to have to do
if(1==1) ++count;
Brian said:Or...
if (true) ++count;
...which is arguably an order of magnitude more readable anyway.
Afterall, I'm still not sure if you wrote the number 1 or the letter l.
Brian
Shouldn't I be able to do this:
if(1) ++count;
it seems really a pain to have to do
if(1==1) ++count;
Willy Denoyette said:Worse? Not at all, if( i = x ) won't even compile as the expression is of
type int and if expects a bool.
Jon Skeet said:No, that's exactly what Daniel was saying. In the kind of situation the
OP was talking about (where if(1) compiles), for instance in C, you get
the type of problem Daniel mentioned.