Mail Archives: djgpp/1996/10/12/07:14:30
On Wed, 9 Oct 1996, Chris Waters wrote:
> In article <53gjj8$5l7 AT mark DOT ucdavis DOT edu>,
> Jeffrey Taylor <elric AT wheel DOT dcn DOT davis DOT ca DOT us> wrote:
> >A.Appleyard (A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk) wrote:
> >: What have I done wrong here? Or can't I use array element labels when the
> >: elements are subarray displays?
> >
> >Correct. You cannot use array labels in C initializers.
>
> Unless you're using gcc. And gee, guess what? :)
>
> The correct answer is that if you have an array of structures, you must
> name the structure fields in your initializers:
>
> craft dsub[128]={
> [1] {codeno: "CH79", name: "Aphanistor"},
> [55] {codeno: "DS1 ", name: "Quackers"},
> [56] {codeno: "DS2 ", name: "Donald"},
> [23] {codeno: "BA32", name: "Big Jim"},
> [35] {codeno: "FA65", name: "Trelawney"}};
Note that this is not available in gnu C++ (according to the info files
:), so if you've tried compiling this with gxx it still will not work.
Pete
---------------
Peter Berdeklis
Dept. of Physics, Univ. of Toronto
- Raw text -