While looking into a piece of code, I saw this line:
if ((b = a)) { /* statements */ }
Reading the context, I know its intention is like this:
b = a;
if (b != 0) { /* statements */ }
I know the two lines above can be simplified into the first code block, but why are the two pair of parentheses? Wouldn't that seem redundant? I think this is totally OK:
if (b = a) { /* statements */ }
Aucun commentaire:
Enregistrer un commentaire