www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/12/07:14:30

Newsgroups: comp.os.msdos.djgpp
From: Peter Berdeklis <peter AT atmosp DOT physics DOT utoronto DOT ca>
Subject: Re: Labelled array display element funny
Message-ID: <Pine.SGI.3.91.961011165926.13377A-100000@chinook.physics.utoronto.ca>
Nntp-Posting-Host: chinook.physics.utoronto.ca
Sender: news AT info DOT physics DOT utoronto DOT ca (System Administrator)
Mime-Version: 1.0
Organization: University of Toronto - Dept. of Physics
In-Reply-To: <designDz11q8.7GI@netcom.com>
Date: Fri, 11 Oct 1996 21:01:43 GMT
References: <7E03B4350B AT fs2 DOT mt DOT umist DOT ac DOT uk> <53gjj8$5l7 AT mark DOT ucdavis DOT edu> <designDz11q8 DOT 7GI AT netcom DOT com>
Lines: 31
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019