Re: C question for you old guys ;-)
Re: C question for you old guys ;-)
- Subject: Re: C question for you old guys ;-)
- From: David Bernard <email@hidden>
- Date: Tue, 10 Jun 2003 19:34:55 +1000
Your probably sick of this thread by know but I wanted to share this
example of a gotya!
x = 0;
if ( debug)
print("Blah blah blah\n"),
x= 1;
....
if ( x == 1 )
{
....
}
This code always worked correctly when debug was turned on!
This supports the {} always on if/while etc.
I did work with someone who was such as style crazy that he decided the
the bigger of the if block versus the else block should determine which
one came first. This guy went around rearranging other peoples code
changing the sense of the if condition
if ( x == 1)
{
big lots of code .....
}
else
{
little bit of code .....
}
Got changed to
if ( x != 1)
{
little bit of code .....
}
else
{
big lots of code .....
}
Message is, try to work with what you've got and don't make it hard for
others who need to read your code. And read, I mean READ code before
you give up and rewrite from scratch.
_______________________________________________
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.