3 ms·
Some older C coding styles recommend that order because before compilers added warnings, “if (17 = variable)” resulted in a diagnostic, while “if (variable = 17
by fweimer 4y ago
Some older C coding styles recommend that order because before compilers added warnings, “if (17 = variable)” resulted in a diagnostic, while “if (variable = 17)” would not. Nowadays, I think most programmers prefer putting the fastest-changing expression first.
- deleted 4y ago[deleted]
- pjmlp 4y agoYeah that is due to clever C semantics that that should never had allowed for anything other than boolean expressions in conditionals like proper grown languages.