delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/11/03:47:14

From: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
Organization: Materials Science Centre
To: djgpp AT delorie DOT com
Date: Fri, 11 Oct 1996 08:40:07 GMT
Subject: Re: Labelled array display element funny
Message-ID: <A8802879BE@fs2.mt.umist.ac.uk>

  A.Appleyard wrote:
>   This program:-
> 1    #include<stdio.h>
> 2    typedef struct{char *codeno; char*name;} craft;
> 3    craft dsub[128]={
> 4         [1] {"CH79","Aphanistor"}, ...
> 9    main(){}
>   produced these errors:-
> t$.cc:5: parse error before `['
> t$.cc:5: warning: aggregate has a partly bracketed initializer
> t$.cc:6: parse error before `[' ...

  Francois Charton <deef AT pobox DOT oleane DOT com> replied:-
> Yes you can, your program is right, but its name is wrong... In GNU C you
> can give the elements in any order, specifying the array indices or
> structure field names they apply to. This extension is not implemented in
> GNU C++.

  Why isn't it!? I can't use C; my big program (rather than the above test)
also uses classes etc.

- Raw text -


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