This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

missing initializer warnings

Another strange warning from the 19980628 snapshot. Here's the source
--begin program
struct S { int a; int b;};
static S s1 = {0};
static S s2 = {}; 
static S s3;
static S ss[2] = {{0}};
--end program

and here's the session log
--begin log
nathan@laie:9959>egcs-0628-g++ -W -c warning: missing initializer for member `b' warning: missing initializer for member `a' warning: missing initializer for member `b' warning: missing initializer for member `b'
--end log
The 1.0.3a release gives no such warning.

I don't like this warning, IMHO it at least shouldn't be enabled by -W,
but by some other flag. I'm quite happy to rely on default initializing
to zero. That's my position on the warning.

Anyhow, the warning conditions themselves appear to be inconsistent. s1
and s2 are moaned about, but s3 is not moaned about, even though it too
is initializing to zero. Similarly the array initializer for ss moans
about ss[0].b but not about ss[1]. This doesn't appear very consistent
-- what is the reasoning behind this?

I know I've been submitting rather a lot of bug reports recently --
please don't think I want `the moon on a stick'. I'm not going ahead and
just `fixing' these things because
a) I don't know my way around the source
b) someone else is probably responsible (in the management sense) for
these bits of source and I wouldn't want to preempt them
c) warnings are a matter of taste and I know my taste is not the
definitive taste. Take this as an input of what particular tastes are
out there.

I just want egcs to be a really good and helpful compiler -- out of all
the ones available to me (which isn't many, to be fair), it's the only
one in the running.


Dr Nathan Sidwell :: Computer Science Department :: Bristol University
      You can up the bandwidth, but you can't up the speed of light

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]