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

Re: Accessors


  • Subject: Re: Accessors
  • From: Bill Cheeseman <email@hidden>
  • Date: Thu, 08 Aug 2002 06:29:55 -0400

on 02-08-08 2:03 AM, Shawn Erickson at email@hidden wrote:

> - setSomeName: (SomeType*)newSomeName
> {
> if (newSomeName == _someName) return;
> [_someName release];
> _someName = [newSomeName copy];
> }

I've noticed a couple of people testing for equality and returning in the
first line, like this. My usual practice is to test for inequality, then
fall through to the bottom if the test is false.

Is there some advantage to the return? I've always thought it was just a
matter of style.

--

Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com

The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
Croquet Club of Vermont - http://members.valley.net/croquetvermont
_______________________________________________
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: Accessors
      • From: Bill Cheeseman <email@hidden>
    • Re: Accessors
      • From: Shawn Erickson <email@hidden>
    • Prgramming style (was: Accessors)
      • From: Ondra Cada <email@hidden>
    • Re: Accessors
      • From: Chris Ridd <email@hidden>
    • Guard clauses vs. early return (Re: Accessors)
      • From: Marcel Weiher <email@hidden>
References: 
 >Re: Accessors (From: Shawn Erickson <email@hidden>)

  • Prev by Date: Re: Cocoa-Pro List
  • Next by Date: Guard clauses vs. early return (Re: Accessors)
  • Previous by thread: Re: Accessors
  • Next by thread: Guard clauses vs. early return (Re: Accessors)
  • Index(es):
    • Date
    • Thread