• 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: Xcode chockes on variable-sized arrays in struct definitions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Xcode chockes on variable-sized arrays in struct definitions


  • Subject: Re: Xcode chockes on variable-sized arrays in struct definitions
  • From: Scott Ribe <email@hidden>
  • Date: Tue, 23 Jan 2007 16:18:22 -0700
  • Thread-topic: Xcode chockes on variable-sized arrays in struct definitions

> In fact when I turned on the 'missing braces around initializer' warning
> it now also gives me that warning in addition to the previous error -
> even when I use the brackets you described below.

I don't think that style of initialization was ever legal C. C99 gets you
the struct { int foo[] } syntax accepted. Correct nesting of braces gets you
initialization of an array member of a struct. But there is no facility for
static initialization of a variable-length (flexible) array member.

It seems to me your options are (some combination of): possibly template
which uses number of array elements as a template parameter, replace the
inline array member with a pointer to an out-of-line array, change from
static initializers to malloc'ing the storage and initializing it at
startup, fixing the length of the array to the maximum size needed.

--
Scott Ribe
email@hidden
http://www.killerbytes.com/
(303) 722-0567 voice


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

This email sent to email@hidden

  • Follow-Ups:
    • [SOLVED] Xcode chockes on variable-sized arrays in struct definitions
      • From: Mike <email@hidden>
References: 
 >Re: Xcode chockes on variable-sized arrays in struct definitions (From: Mike <email@hidden>)

  • Prev by Date: Re: Is there a 1GB memory ceiling for vm_allocate?
  • Next by Date: Re: Objective-C exception handler blocks skipped
  • Previous by thread: Re: Xcode chockes on variable-sized arrays in struct definitions
  • Next by thread: [SOLVED] Xcode chockes on variable-sized arrays in struct definitions
  • Index(es):
    • Date
    • Thread