[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210816190518.GK7722@kadam>
Date: Mon, 16 Aug 2021 22:05:18 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: "Russell King (Oracle)" <linux@...linux.org.uk>
Cc: Al Viro <viro@...iv.linux.org.uk>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Leon Romanovsky <leon@...nel.org>,
Joe Perches <joe@...ches.com>,
Dwaipayan Ray <dwaipayanray1@...il.com>,
Andy Whitcroft <apw@...onical.com>,
Lukas Bulwahn <lukas.bulwahn@...il.com>,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
Julia Lawall <julia.lawall@...ia.fr>
Subject: Re: [PATCH] checkpatch: prefer = {} initializations to = {0}
On Mon, Aug 16, 2021 at 08:23:45AM +0100, Russell King (Oracle) wrote:
> > That's out of date. It changed in C11. Both = { 0 } and = { } will
> > clear out struct holes. The = { } GCC extension has always initialized
> > struct holes.
> >
> > http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548.pdf
> >
> > For partial initializations then all the padding is zeroed.
> > Unfortunately if you fully initialize the struct then padding is not
> > initialized.
>
> If we're going to discuss which C standard applies to the kernel,
> then...
>
> As Kbuild passes -std=gnu89, the kernel expects C89 behaviour with
> GNU extensions from the compiler, both C99 and C11 are not that
> relevant, although the GNU extensions include some bits from these
> standards.
That's fine. The GCC implementation has always been okay. The question
is if we could rely on it going forward so now that it's part of the
spec that's very reassuring.
regards,
dan carpenter
Powered by blists - more mailing lists