• 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: How do I get NSRect to be the same as CGRect?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I get NSRect to be the same as CGRect?


  • Subject: Re: How do I get NSRect to be the same as CGRect?
  • From: "Ken Ferry" <email@hidden>
  • Date: Mon, 17 Dec 2007 13:31:39 -0800

The implementation should be okay with or without with -fstrict-aliasing.

Pointer casting still works too, it's just ugly and screws up type
checking (and violates strict aliasing).  NSRectToCGRect and friends
were added as convenience.

Struct tags also show up in objective-c method signatures, which are
introspectable and in @encode directives, which are evaluated to c
strings at compile time.  Code that wants to treat  NSRect, NSPoint
and NSSize specially (e.g. KVC's object wrapping of those return
types) tends to require a recompile when struct tags in the method
signatures change.  Obviously KVC itself isn't a problem, since it
ships in sync with the NSGeometry header, but external clients can
(and do) have similar dependencies.

The difference between long and int is also introspectable in method signatures.

Ken Ferry
Cocoa Frameworks

On Dec 17, 2007 1:11 PM, Rick Mann <email@hidden> wrote:
>
> On Dec 17, 2007, at 1:04 PM, Sean McBride wrote:
>
> > I agree it's unlikely, but the possibility is no doubt the reason for
> > NSRectToCGRect() existing (it uses the union trick).
>
> I think that means that NSRectToCGRect() must take care to be compiled
> with the correct setting of -fstrict-aliasing.
>
> > Could you not make your Graphics::Rect class Objective-C++?  Just
> > changing its extension should do the trick.
>
> Perhaps, but it would limit its usefulness. All files that included
> the header file would need to use .mm as an extension.
>
> --
> Rick
>
>
> _______________________________________________
>
> 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
>
_______________________________________________

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: 
 >How do I get NSRect to be the same as CGRect? (From: Rick Mann <email@hidden>)
 >Re: How do I get NSRect to be the same as CGRect? (From: "Clark Cox" <email@hidden>)
 >Re: How do I get NSRect to be the same as CGRect? (From: Rick Mann <email@hidden>)
 >Re: How do I get NSRect to be the same as CGRect? (From: "Sean McBride" <email@hidden>)
 >Re: How do I get NSRect to be the same as CGRect? (From: Rick Mann <email@hidden>)
 >Re: How do I get NSRect to be the same as CGRect? (From: "Sean McBride" <email@hidden>)
 >Re: How do I get NSRect to be the same as CGRect? (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: How do I get NSRect to be the same as CGRect?
  • Next by Date: Re: How to implement an "Accordion" view?
  • Previous by thread: Re: How do I get NSRect to be the same as CGRect?
  • Next by thread: Re: How do I get NSRect to be the same as CGRect?
  • Index(es):
    • Date
    • Thread