• 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: "Smith, Bradley" <email@hidden>
  • Date: Thu, 8 Aug 2002 12:50:48 +0100

Not just a matter of style. In the example the method has more than one exit
point. Many people (myself included) think this should be avoided *if
possible* (if you want reasons why then mail me off list as I don't want to
bore everyone.

Brad

> From: Bill Cheeseman [mailto:email@hidden]
> Sent: Thursday, August 08, 2002 11:30
> To: Cocoa-Dev Mail
> Subject: Re: Accessors
>
>
> 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.
_______________________________________________
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.

  • Prev by Date: Re: Accessors
  • Next by Date: Re: Changing PDF pages
  • Previous by thread: Re: Accessors
  • Next by thread: NSRunLoop and port
  • Index(es):
    • Date
    • Thread