Re: C question for you old guys ;-)
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.