Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #8533

Re: Setting Structure Defaults

From "Bo Persson" <bop@gmb.dk>
Newsgroups comp.lang.c++
Subject Re: Setting Structure Defaults
Date 2011-08-07 12:30 +0200
Message-ID <9a77qdFn1oU1@mid.individual.net> (permalink)
References <MPG.28a736d5dcd815509896c4@news.eternal-september.org> <j1k4rr$ujc$1@dont-email.me> <MPG.28a7d6d1917d30d9896c5@news.eternal-september.org>

Show all headers | View raw


Mike Copeland wrote:
> In article <j1k4rr$ujc$1@dont-email.me>, v.bazarov@comcast.invalid
> says...
>> On 8/6/2011 2:33 PM, Mike Copeland wrote:
>>>     I'm trying to create a structure and populate it with default
>>> values. Below is my attempt, but it fails (badly) to compile.
>>> What did I do wrong here?  How might I fix this?  TIA
>>>
>>> #define ERLIMIT 5
>>> struct ERMENU
>>> {
>>>     string title;
>>>     short  xAxis, yAxis;
>>>     short  titleLen, dataLen;
>>>     short  linkPrior, linkNext;
>>>     short  option;
>>>     WORD   dispAttr;
>>>     short  erHead, erTail, erCurrent;
>>> } erMenu[ERLIMIT] =
>>>     {
>>>      {"category1", 2, 4, 9, 1, 0, 0, 0, LONORM, 0, 0, 0},
>>>      {"category2", 2, 5, 9, 1, 0, 0, 0, LONORM, 0, 0, 0},
>>>      {"category3", 2, 6, 9, 1, 0, 0, 0, LONORM, 0, 0, 0},
>>>      {"category4", 2, 7, 9, 1, 0, 0, 0, LONORM, 0, 0, 0},
>>>      {"category5", 2, 8, 9, 1, 0, 0, 0, LONORM, 0, 0, 0}
>>>     };
>>>
>> This is covered by FAQ 5.8.  Please read the FAQ before posting.
>
>   I don't understand.  The FAQ reference (5.8) has nothing to do
> with my query here, and examining the FAQ doesn't lead me to a
> resolution of my problem.  I'm seeking an understanding of how to
> initialize a structure element that is declared as basic::string,
> which is the root cause of my compile errors.
>   I can't find anything in the FAQ that deals with this.  8<{{

It's a meta reference - One of the points of 5.8 is that you should 
tell us WHAT message you get from the compiler.

And you just did!


Bo Persson

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Setting Structure Defaults mrc2323@cox.net (Mike Copeland) - 2011-08-06 11:33 -0700
  Re: Setting Structure Defaults Victor Bazarov <v.bazarov@comcast.invalid> - 2011-08-06 15:31 -0400
    Re: Setting Structure Defaults mrc2323@cox.net (Mike Copeland) - 2011-08-06 22:55 -0700
      Re: Setting Structure Defaults "Balog Pal" <pasa@lib.hu> - 2011-08-07 08:46 +0200
      Re: Setting Structure Defaults "Bo Persson" <bop@gmb.dk> - 2011-08-07 12:30 +0200
        Re: Setting Structure Defaults mrc2323@cox.net (Mike Copeland) - 2011-08-07 09:17 -0700
          Re: Setting Structure Defaults Geoff <geoff@invalid.invalid> - 2011-08-07 10:00 -0700
            Re: Setting Structure Defaults Victor Bazarov <v.bazarov@comcast.invalid> - 2011-08-07 13:17 -0400
          Re: Setting Structure Defaults Victor Bazarov <v.bazarov@comcast.invalid> - 2011-08-07 13:16 -0400

csiph-web