This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: braces around scalar initializer
- From: Joaquin Ferruz Melero <ferruz at cartuja dot us dot es>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 11 Dec 2002 11:59:29 +0100
- Subject: Re: braces around scalar initializer
- References: <000701c2a103$1b8a0880$3c01a8c0@SERVANT>
David Cullen wrote:
> Why doesn't this work:
>
> Rectangle *cherry[] = { { 10, 10, 100, 100 }, NULL };
>
> Display.c:137: warning: braces around scalar initializer
> Display.c:137: warning: (near initialization for `cherry[0]')
>
> May God bless you,
> David Cullen
The compiler is expecting a list of pointers (scalars), because
"cherry" is an array of pointers, not an array of "Rectangle"s. You can
only use embedded braces for members which are agregates themselves.
Regards,
Joaquín Ferruz
begin:vcard
n:Ferruz Melero;Joaquin
tel;fax:34 954 48 73 40
x-mozilla-html:FALSE
org:Escuela de Ingenieros de Sevilla;Ingeniería de Sistemas y Automática
adr:;;Camino de los Descubrimientos, S/N;Sevilla;;41092;España
version:2.1
email;internet:ferruz@cartuja.us.es
title:Profesor Titular de Universidad
end:vcard