• 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: 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.
References: 
 >Re: C question for you old guys ;-) (From: Buddy Kurz <email@hidden>)

  • Prev by Date: Re: [OT] Where to get short sounds?
  • Next by Date: Re: NSUnarchiver unarchiveObjectWithData problem
  • Previous by thread: Re: C question for you old guys ;-)
  • Next by thread: Re: C question for you old guys ;-)
  • Index(es):
    • Date
    • Thread