• 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: Good idea/bad idea?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Good idea/bad idea?


  • Subject: Re: Good idea/bad idea?
  • From: John McCall <email@hidden>
  • Date: Thu, 24 Apr 2014 10:37:32 -0700

On Apr 24, 2014, at 9:53 AM, Alex Zavatone <email@hidden> wrote:
> What worried me was that I've never seen this used in Objective-C in this manner.  I've always used the ? operator to color the backgrounds of cells with alternating row colors.  It seemed like a stretch to actually use it to achieve lazy instantiation and was wondering if there were any terrible demons I'd be summoning from the bowels of the compiler if we actually thought of using this approach.

No, it’s a supported feature across all types; we had to invent some interesting machinery a few years back to make it work consistently, akin to what we have to do for compound assignment on an Objective-C property reference, but that’s been in and stable for a long time.

Anyway, it even works on non-POD C++ types, if you’re into that — although if you’re hyper-sensitive to performance, be aware that (unlike the normal ternary operator) it is not possible to construct the left operand directly into the result because of some subtle order-of-destruction issues, and so there does have to be an unelidable copy/move.

John.
_______________________________________________

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


References: 
 >Good idea/bad idea? (From: Alex Zavatone <email@hidden>)
 >Re: Good idea/bad idea? (From: Raheel Ahmad <email@hidden>)
 >Re: Good idea/bad idea? (From: Alex Zavatone <email@hidden>)
 >Re: Good idea/bad idea? (From: Roland King <email@hidden>)
 >Re: Good idea/bad idea? (From: Alex Zavatone <email@hidden>)

  • Prev by Date: Re: Mouse cursors and overlapping sibling NSViews
  • Next by Date: Re: Good idea/bad idea?
  • Previous by thread: Re: Good idea/bad idea?
  • Next by thread: Re: Good idea/bad idea?
  • Index(es):
    • Date
    • Thread