Kenneth Porter wrote:
I always code constants on the left, to catch just the typo you made in your example.

It gets to be a religious argument. The two sides are:

1) It catches a common typo that is hard for the eye to notice and is hard to debug.

2) It looks ugly and any decent compiler will issue a warning if it sees an assignment in an if conditional.

I think that the second side has the compelling argument, but only if the compiler that is used cooperates. Which all compilers I know of do if you set the options correctly.

Compiling with full warnings on and then getting rid of anything that generates a warning is a great way of catching obscure bugs, even if not every warning is caused by a bug.

 -- sidney



Reply via email to