• 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: Making my own constants for Cocoa structs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making my own constants for Cocoa structs


  • Subject: Re: Making my own constants for Cocoa structs
  • From: Scott Ribe <email@hidden>
  • Date: Fri, 03 Aug 2007 12:11:10 -0400
  • Thread-topic: Making my own constants for Cocoa structs

> I didn't realize that these structures could be
> treated the same as a C array (?).

They're simply C structs, and follow the standard C syntax for
initialization.

Note that in some versions of C, const NSRect myConstRect={1,2,3,4}; will
give a warning, because actually using the layout of the structure is
preferred, as in const NSRect myConstRect={{1,2},{3,4}}; since an NSRect is
an NSPoint and NSSize.

Also note that there are macros defined: NSMakeRect, NSMakePoint, and
NSMakeSize. These are documented in a place you probably haven't yet found,
because they're lumped together with a lot of simple functions that don't
belong to any class, while most of the Coco docs are arranged around
classes. Just search on any of those macros...

--
Scott Ribe
email@hidden
http://www.killerbytes.com/
(303) 722-0567 voice


_______________________________________________

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

  • Follow-Ups:
    • Re: Making my own constants for Cocoa structs
      • From: Paul Bruneau <email@hidden>
References: 
 >Re: Making my own constants for Cocoa structs (From: Paul Bruneau <email@hidden>)

  • Prev by Date: Re: [OT] "Fluent Interface"? Welcome to NeXT
  • Next by Date: Re: [OT] "Fluent Interface"? Welcome to NeXT
  • Previous by thread: Re: Making my own constants for Cocoa structs
  • Next by thread: Re: Making my own constants for Cocoa structs
  • Index(es):
    • Date
    • Thread