• 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: Variadic arguments to methods in Objective-C - How ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Variadic arguments to methods in Objective-C - How ?


  • Subject: Re: Variadic arguments to methods in Objective-C - How ?
  • From: "Erik M. Buck" <email@hidden>
  • Date: Sat, 8 Jan 2005 17:23:59 -0500

>works like a charm, altho if there is a better way to do this I am all
>ears !

If all you want is dynamic storage for ints and you don't need to create
lots of NSNumber instance,
how about NSMutableData and use the -mutableBytes method to access memory as
an array of ints ?
You can increate the size of the storage at will: -increaseLengthBy:


NSMutableData aBunchOfInts = [NSMutableData dataWithLength:(4 *
sizeof(int)];
int           *bytes = [aBunchOfInts  mutableBytes];
bytes[0] = 45;
bytes[3] = 11;

[aBunchOfInts -increaseLengthBy:16];

bytes[19] = -29;
[aBunchOfInts appendBytes:someMoreIntsInACArray length:someLengthInBytes];

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: mouseExited: acts very unreliably?
  • Next by Date: Re: Variadic arguments to methods in Objective-C - How ?
  • Previous by thread: Re: Variadic arguments to methods in Objective-C - How ?
  • Next by thread: Re: Variadic arguments to methods in Objective-C - How ?
  • Index(es):
    • Date
    • Thread