Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Feb 2001 18:03:33 +0000
From:      j mckitrick <jcm@FreeBSD-uk.eu.org>
To:        freebsd-chat@freebsd.org
Subject:   bad programming practice?
Message-ID:  <20010223180321.A33329@dogma.freebsd-uk.eu.org>

next in thread | raw e-mail | index | archive | help

I recently posted an example showing a simple C rule my company uses that
eliminates a simple error.

if(var == CONST)

can generate a bug if you forget an equals sign.

But using

if(CONST == var)

will create an error if you forget an equals sign.

Obviously, this is just a trick to prevent a sloppy coding error, but why is
it so disdained?  What is wrong with using such tricks to make our job
easier?

Jonathon
--
Tech support:  Try this.  Arrange the parts in neat piles.  Stand on your
chair until you can see over your cubicle walls.  Now shout "Does anybody
know how to read a manual?"

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-chat" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010223180321.A33329>