delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/09/18:49:26

Date: Mon, 9 Mar 1998 15:48:38 -0800 (PST)
Message-Id: <199803092348.PAA11478@adit.ap.net>
Mime-Version: 1.0
To: "Andreas 'LionKing' Tscharner" <andy AT neelix DOT iiic DOT ethz DOT ch>,
djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Allegro-GUI-Problem

At 12:50  3/8/1998 +0100, Andreas 'LionKing' Tscharner wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>
>Hello World,
>
>I have the following problem:
>
>DIALOG *MyDialog;
>
>MyDialog = new DIALOG[n];
>MyDialog[0] = {d_shadow_box_proc, x, .....};
>
>The compiler says "Parse error before '{'". What's the problem? How do I
>fix it?

Flame me if I'm wrong, but I don't think you can initialize a dynamic struct
like that. In fact, I don't think standard C/C++ lets you do it at all.
Either you can initialize it one field at a time:

MyDialog[0].foo = d_shadow_box_proc;
MyDialog[0].bar = x;

Or you can use a GNU extension (see info node "Constructor Expressions"):

MyDialog[0] = ((DIALOG) {d_shadow_box_proc, x, ...});

Hope this helps.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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