• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: C question for you old guys ;-)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C question for you old guys ;-)


  • Subject: Re: C question for you old guys ;-)
  • From: Steve Bird <email@hidden>
  • Date: Wed, 11 Jun 2003 18:47:44 -0400

On Wednesday, June 11, 2003, at 04:53 PM, Jay Prince wrote:

On Wednesday, June 11, 2003, at 11:06 AM, Simon Stapleton wrote:
No, it doesn't improve readability. Having come across this particular atrocity a few times in my career, I can say that _every_ time I've seen it, it's taken longer to read the code.


Maybe I missed it, but why do people not just put the constant on the left-hand side of the comparison?

if (1 = foo) won't compile. Typing = instead of == is a bug I've only committed once, that I can recall... but I started putting the constant on the left just in case anyway.


Maybe you can explain to me why, if you can remember to reverse the "natural" order of things when you're typing, you can't just remember to type the second "=" to begin with?

I already explained why *I* don't do it - I never ask the question:

if (31 cents = Change)
ThankCashier();
else
Complain();

In my mind, it's always:
if (Change = 31 cents)
....

If I can't remember to put the second "=" in, why would I remember to reverse the operand order?

----------------------------------------------------------------
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
www.Culverson.com (toll free) 1-877-676-8175
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: C question for you old guys ;-)
      • From: Jay Prince <email@hidden>
References: 
 >Re: C question for you old guys ;-) (From: Jay Prince <email@hidden>)

  • Prev by Date: Re: Getting coverart from a track via AppleScript
  • Next by Date: Re: NSTableView question (odd / even row colors)
  • Previous by thread: Re: C question for you old guys ;-)
  • Next by thread: Re: C question for you old guys ;-)
  • Index(es):
    • Date
    • Thread