MLUG: Re: [MLUG] Quick programming question on style
Re: [MLUG] Quick programming question on style
Email address obfuscation in effect -- please click here to turn it off.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
On Fri, Jun 03, 2005 at 09:33:33AM -0500, McIntosh Jason wrote:
> ----------
> 
> if (mydate.save())
> {
> }else {
> }
> -----------

This looks to me as if someone was planning on putting some
success/fail/debug code in but just never did it. 

> if (testcase == 1) {
> 
> or
> 
> if (testcase == 1)
> {

Personally I use the first style, but switch it to:

    if (1 == testcase) {

That way if you make the common mistake of using a '=' instead of an
'==' you'll get a compiler error.  I have no idea where I first liearned
this but I tend to use it in any langugae.  Putting the constant on the
left side of the comparison prevents accidentally assigning a value to
the variable.

enjoy,

-jeremy

-- 
========================================================================
 Jeremy Hinegardner                              EMAIL:PROTECTED 

_______________________________________________
members mailing list
EMAIL:PROTECTED
http://mlug.missouri.edu/mailman/listinfo/members