if - else

Alan Gauld alan.gauld at btinternet.com
Fri Nov 28 14:54:35 EST 2003


On Fri, 28 Nov 2003 12:35:45 GMT, "Georgy Pruss"
<see_signature__ at hotmail.com> wrote:

> | if (10 == sum) {...}
> |
> | rather than
> |
> | if (sum == 10) {...}
> 
> Yes, there's such a style, and it's considered by experienced C
> programmers to be as weird as if( (a<b) == TRUE )...

Dunno about that, I've been using C since 1986 and every C
project I've worked on since 1991 (about half a dozen biggish
ones) has mandated the

if (CONST == variable)...

style of if statement check, and most of the recent books
recommend it. So an awful lot of experienced C programmers 
use it day in day out - and I haven't heard any loud complaints.
Generally anything that saves bugs in C is "A Good Thing", its
like running lint - you just build it into the make rules so that
you never forget...

Alan G.




Author of the Learn to Program website
http://www.freenetpages.co.uk/hp/alan.gauld




More information about the Python-list mailing list