• 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: very simple NSRange q
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: very simple NSRange q


  • Subject: Re: very simple NSRange q
  • From: "Alastair J.Houghton" <email@hidden>
  • Date: Tue, 12 Aug 2003 10:21:28 +0100

On Tuesday, August 12, 2003, at 04:03 am, Andrew Pinski wrote:

On Monday, Aug 11, 2003, at 10:13 US/Eastern, Alastair J.Houghton wrote:
Use NSMakeRange(). The second one doesn't work because it isn't legal to write an initialiser (which is what {start, length} is) in code, only in a declaration. You *can* work around this with GCC by writing (NSRange){start, length}, but it's a non-standard extension. Better to use the helpfully provided NSMakeRange() function. BTW, there are similar functions for many of the other struct types.
(NSRange){start, length} is not a non standard extension as it is part of ISO C99.

Good point. I'd forgotten that they'd added it to the standard; it *used to be* a non-standard extension. Anyway, since there's a function/macro to initialise these things, it's probably best to use that.

Kind regards,

Alastair.
_______________________________________________
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.

References: 
 >Re: very simple NSRange q (From: Andrew Pinski <email@hidden>)

  • Prev by Date: Puzzling CGBitmapImageCreate problem
  • Next by Date: Triangle Collapse
  • Previous by thread: Re: very simple NSRange q
  • Next by thread: Custom Cocoa control using Carbon? Possible? Examples?
  • Index(es):
    • Date
    • Thread