* Fw: strange 'warning: missing initializer'
@ 2006-11-20 0:26 Jiri Slaby
2006-11-20 3:41 ` John Love-Jensen
0 siblings, 1 reply; 2+ messages in thread
From: Jiri Slaby @ 2006-11-20 0:26 UTC (permalink / raw)
To: gcc-help
> Hi,
>
> what's the difference for gcc in dot notation and direct value here:
> cat >c.c <<EOF
> struct {
> unsigned int a, b;
> } b[] = {
> { .a = 0 }
> }, c[] = {
> { 0 }
> };
> EOF
>
> Why $ gcc -W c.c -occ -c
> c.c:6: warning: missing initializer
> c.c:6: warning: (near initialization for 'c[0].b')
> complains only for c[] (and not for b[])?
>
> I use $ gcc --version
> gcc (GCC) 4.1.1 20061011 (Red Hat 4.1.1-30)
> and $ gcc34 --version
> gcc34 (GCC) 3.4.6 20060404 (Red Hat 3.4.6-4)
> with the same result.
>
> Any clues?
please, could you answer the question for me here? (I tried gcc.gnu newsgroup
for the first time)
thanks,
--
http://www.fi.muni.cz/~xslaby/ Jiri Slaby
faculty of informatics, masaryk university, brno, cz
e-mail: jirislaby gmail com, gpg pubkey fingerprint:
B674 9967 0407 CE62 ACC8 22A0 32CC 55C3 39D4 7A7E
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: strange 'warning: missing initializer'
2006-11-20 0:26 Fw: strange 'warning: missing initializer' Jiri Slaby
@ 2006-11-20 3:41 ` John Love-Jensen
0 siblings, 0 replies; 2+ messages in thread
From: John Love-Jensen @ 2006-11-20 3:41 UTC (permalink / raw)
To: Jiri Slaby, MSX to GCC
Hi Jiri,
As per the documentation,
http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
-Wmissing-field-initializers
Warn if a structure's initializer has some fields missing. For example, the
following code would cause such a warning, because x.h is implicitly zero:
struct s { int f, g, h; };
struct s x = { 3, 4 };
This option does not warn about designated initializers, so the following
modification would not trigger a warning:
struct s { int f, g, h; };
struct s x = { .f = 3, .g = 4 };
This warning is included in -Wextra. To get other -Wextra warnings without
this one, use '-Wextra -Wno-missing-field-initializers'.
HTH,
--Eljay
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-11-20 3:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-20 0:26 Fw: strange 'warning: missing initializer' Jiri Slaby
2006-11-20 3:41 ` John Love-Jensen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).