• 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: struct with indeterminate array(size)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: struct with indeterminate array(size)


  • Subject: Re: struct with indeterminate array(size)
  • From: "Erik M. Buck" <email@hidden>
  • Date: Thu, 4 Oct 2001 11:18:18 -0500

> typedef struct tcPointList
> {
> int size;
> tcPoint points[];
> }tcPointList;
>

The Objective-C runtime uses the same technique. It is reasonably common in
C programs. The trick to make it compile to use a size of 1.

typedef struct tcPointList
{
int size;
tcPoint points[1]; // this will compile!
}tcPointList;

Then use the same malloc technique for arrays with more elements than 1.


  • Follow-Ups:
    • Re: struct with indeterminate array(size)
      • From: Greg Titus <email@hidden>
  • Prev by Date: Re: struct with indeterminate array(size)
  • Next by Date: DO and Crontab
  • Previous by thread: Re: struct with indeterminate array(size)
  • Next by thread: Re: struct with indeterminate array(size)
  • Index(es):
    • Date
    • Thread