Re: How to add my custom structure to NSMutable Array??Pls help.
Re: How to add my custom structure to NSMutable Array??Pls help.
- Subject: Re: How to add my custom structure to NSMutable Array??Pls help.
- From: "M. Uli Kusterer" <email@hidden>
- Date: Fri, 11 Jul 2003 20:09:13 +0200
At 12:50 Uhr -0500 11.07.2003, Jeff Harrell wrote:
I've never been of the opinion that you should do things the
object-oriented way just to say that you did. My opinion is that you
should do what works. Structs are nice, simple, lightweight
constructs. Heck, NSPoint, NSSize, and NSRange are all structs.
I couldn't agree more. Never do something as an object just to say
you could make it OOP. However...
In this case, I would vote for Dylan's suggestion of an NSValue
wrapped around a pointer to a struct.
I wouldn't. Pointers to structs have the habit of going away. I
would at least use an NSData instead. If someone passes a pointer to
a stack variable to an NSValue, the variable is gone after this
function call. Since the original poster seemed to be a newbie at
least to ObjC, I chose to offer a solution that forces him to
allocate the proper storage, and takes care of deallocating it when
it's removed from the array.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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.