C's syntax

Erik Max Francis max at alcyone.com
Mon Oct 23 11:37:53 EDT 2000


Olivier Dagenais wrote:

> To get around this, we were taught to put the constant on the other
> side, so
> that if we forgot an '=', we would get a compiler error:
> 
> if ( 0 = a )   /* is bad */
> if ( 0 == a )  /* is good */

Which is a common coding style, but is really unnecessary.  Any
reasonable compiler will warn against statements such as `if (a = 0)
...'.  Simply look at the warnings, there's no reason to write things in
an unnatural order.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ I love mankind; it's people I can't stand.
\__/ Charles Schultz
    Crank Dot Net / http://www.crank.net/
 Cranks, crackpots, kooks, & loons on the Net.



More information about the Python-list mailing list