[PATCH] Use implicit zero initialize for the whole array.
Anton Lundin
glance at acc.umu.se
Mon Dec 9 15:30:59 UTC 2013
On 10 December, 2013 - Lubomir I. Ivanov wrote:
> On 9 December 2013 23:37, Anton Lundin <glance at acc.umu.se> wrote:
> > Clang yelled about it, and it looks prettier. It also felt kinda strange
> > to explicit initialize the first element to zero and the rest to zero
> > implicit.
> >
> > Signed-off-by: Anton Lundin <glance at acc.umu.se>
> > ---
> > qt-ui/maintab.cpp | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
> > index 9810ab5..21451d9 100644
> > --- a/qt-ui/maintab.cpp
> > +++ b/qt-ui/maintab.cpp
> > @@ -442,7 +442,7 @@ void MainTab::updateDiveInfo(int dive)
> > ui.otuText->setText(QString("%1").arg(d->otu));
> > ui.waterTemperatureText->setText(get_temperature_string(d->watertemp, TRUE));
> > ui.airTemperatureText->setText(get_temperature_string(d->airtemp, TRUE));
> > - volume_t gases[MAX_CYLINDERS] = { 0 };
> > + volume_t gases[MAX_CYLINDERS] = {};
>
> huh, that's odd. i don't see anything wrong in initializing that
> buffer of 8 int values to zero.
> what was the exact clang message?
>
qt-ui/maintab.cpp:445:37: warning: suggest braces around initialization of subobject [-Wmissing-braces]
Anyway, it looked prettier to use the default zero's all the way. I
actually discussed the issue with a couple of friends in #bastuklubben,
a irc channel for a couple of old uni-frends of mine, and they agreed
that it actually looked prettier to =)
//Anton
--
Anton Lundin +46702-161604
More information about the subsurface
mailing list