• 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: Declaring multidimensional arrays in obj-c
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Declaring multidimensional arrays in obj-c


  • Subject: Re: Declaring multidimensional arrays in obj-c
  • From: Don Arnel <email@hidden>
  • Date: Tue, 2 Sep 2008 17:35:02 -0400

Thanks, everyone. I guess I'm going the pointer/malloc way.

On Sep 2, 2008, at 5:27 PM, Keary Suska wrote:

9/2/08 2:57 PM, also sprach email@hidden:

I don't see the problem...
Just use a pointer to a pointer to a pointer to a ...
Every array in C is just a hidden pointer and if you try to
dynamically allocate an array in C then you are left only with one
option: malloc, calloc, realloc

No one has suggested that there aren't functional equivalents, simply that
it is not possible to declare a variable length array as an object ivar,
which is what the OP was (directly) asking.


On 02 Sep 2008, at 22:49, Keary Suska wrote:

9/2/08 2:25 PM, also sprach email@hidden:

I'm having a devil of a time trying to figure out what seems to be a
pretty basic scenario: declaring a multidimensional array in the
interface section of a class when the array dimensions are unknown
until runtime. Can anyone point me in the right direction with this
one?

If you mean C arrays, AFAIK you can't. C99 spec'ed variable length arrays
(VLAs) don't work that way. It will work out, IIRC, that you can only use
them as stack variables. And not static ones either. I believe it's because
of the initialization rule for VLAs.


Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


_______________________________________________

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

_______________________________________________

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: Declaring multidimensional arrays in obj-c
      • From: "Ken Ferry" <email@hidden>
References: 
 >Re: Declaring multidimensional arrays in obj-c (From: Keary Suska <email@hidden>)

  • Prev by Date: Re: Declaring multidimensional arrays in obj-c
  • Next by Date: Re: Get confused with initWithData:encoding:
  • Previous by thread: Re: Declaring multidimensional arrays in obj-c
  • Next by thread: Re: Declaring multidimensional arrays in obj-c
  • Index(es):
    • Date
    • Thread