• 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: Prgramming style (was: Accessors)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Prgramming style (was: Accessors)


  • Subject: Re: Prgramming style (was: Accessors)
  • From: Julian Barkway <email@hidden>
  • Date: Thu, 8 Aug 2002 06:35:29 -0700 (PDT)

On Thursday, Aug 08, 2002, at 05:53AM, Ondra Cada <email@hidden> wrote:

>
>Finally, I can't resist to point out that it's funny how -- at least in
>those first four-odd follow-ups I've seen in the list already -- nicely
>correlates style rigidness with the "I know best what's good for you"
>attitude: we who prefer the early return say "do what suits you"; those
>who prefer rigid style say "do what suits me"! ;))))

Well, those who dislike the early return could always do something like:

if (x == y)
goto method_end;

[y retain];
[x release];
x = y;

method_end:
return;

But that opens up a whole new can of worms!

I generally use the 'early return' for error conditions where coding an 'else' might be confusing,
eg:

rc = [foo bar];
if (rc != ok_code)
return error_code;

// do stuff

return ok_code;

--
Julian Barkway,
Zurich,
Switzerland
_______________________________________________
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: NSRunLoop and NSNotification
  • Next by Date: Re: NSTextField: newbie answer and questions
  • Previous by thread: Re: NSRunLoop and NSNotification
  • Next by thread: Re: Another try: removing the focus from an NSTextField
  • Index(es):
    • Date
    • Thread