• 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: argument checks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: argument checks


  • Subject: Re: argument checks
  • From: "Hamish Allan" <email@hidden>
  • Date: Thu, 12 Jun 2008 15:02:54 +0100

On Thu, Jun 12, 2008 at 6:50 AM, Ashley Perrien <email@hidden> wrote:

> Noob question: I'm putting together a small code library and I'm trying to
> include some error checking in the methods; what I want to protect against
> is the following:
>
> NSNumber *myNum;
>
> // Lots of code where I've forgotten to actually do anything with myNum
>
> results = [myClass someCalculationUsing: myNum];

I'd recommend not declaring myNum until you are ready to define it.
Making all your declarations upfront is a hangover from when compilers
weren't so clever; thankfully, GCC facilitates a more useful locality
of reference.

Hamish
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: argument checks
      • From: Alastair Houghton <email@hidden>
References: 
 >argument checks (From: Ashley Perrien <email@hidden>)

  • Prev by Date: Re: NSTextView and changing the selected text's color
  • Next by Date: Re: Troubles with CollectionView and IKImageBrowserView
  • Previous by thread: Re: argument checks
  • Next by thread: Re: argument checks
  • Index(es):
    • Date
    • Thread