Re: very simple NSRange q
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.