Greetings everyone. I have noticed that in many if conditions the following syntax is used:
a) if (variable == NULL) { ... } b) if (variable == -1) { ... } c) if (variable != NULL) { ... } What I wanted to ask is, is there a particular reason for not choosing a) if (!variable) { ... } in place of if (variable == NULL) { ... }, b) if (-1 == variable) { ... } in place of if (variable == -1) { ... }, and c) if (variable) { ... } in place of if (variable) { ... } ? Especially the (b) syntax is extremely dangerous to assign -1 to variable in case of an accidental mistyping of equals sign; it had happened countless times by now to to many of us that use various C-family languages. Is there a particular reason for using this specific coding style? Regards, Stefanos -- https://mail.python.org/mailman/listinfo/python-list