• 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
Good Habits (was: Re: C question for you old guys ;-))
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Good Habits (was: Re: C question for you old guys ;-))


  • Subject: Good Habits (was: Re: C question for you old guys ;-))
  • From: Shimaron Greywolf <email@hidden>
  • Date: Mon, 9 Jun 2003 09:15:12 +0200

In fact, when I started out with C++, I intentionally picked a style guide
that I now follow. Many good thoughts there. I totally agree with writing
a comment when you intentionally leave something out. This really helps one
to find bugs in a code review.

Another example is switch() {...} statements. Everybody knowns that a
"case" without a "break" falls through to the next case. Yes, danger's
lurking in the shadows. I write my code like this:

switch (i) {
case 1:
blabla;
break;
case 2:
moreblabla;
// Falls through
case 3;
evenmoreblabla;
break;
default:
oops:
}

Another thing may also be noted here: I _always_ include a default case that
is executed if no other case matches. Good spot for an exception in many
cases.

What "good habits" does anyone else have?

Chris
_______________________________________________
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: Good Habits (was: Re: C question for you old guys ;-))
      • From: Oscar Morales Vivó <email@hidden>
References: 
 >Re: C question for you old guys ;-) (From: Greg Weston <email@hidden>)

  • Prev by Date: Re: Using Grab Services
  • Next by Date: Re: Fw: NSBitmapImageRep bitmapData and 16 bits per sample
  • Previous by thread: Re: C question for you old guys ;-)
  • Next by thread: Re: Good Habits (was: Re: C question for you old guys ;-))
  • Index(es):
    • Date
    • Thread