From: Segher Boessenkool <segher@kernel.crashing.org>
To: "Michal Suchánek" <msuchanek@suse.de>
Cc: lkp@intel.com, linux-kernel@vger.kernel.org, npiggin@gmail.com,
Julia.Lawall@inria.fr, paulus@samba.org,
Jason Wang <wangborong@cdjrlc.com>,
linuxppc-dev@lists.ozlabs.org, hbathini@linux.ibm.com,
joel@jms.id.au
Subject: Re: [PATCH] powerpc: Remove the static variable initialisations to 0
Date: Sat, 23 Jul 2022 14:22:11 -0500 [thread overview]
Message-ID: <20220723192211.GP25951@gate.crashing.org> (raw)
In-Reply-To: <20220723133405.GF17705@kitsune.suse.cz>
On Sat, Jul 23, 2022 at 03:34:05PM +0200, Michal Suchánek wrote:
> Hello,
>
> On Sat, Jul 23, 2022 at 05:24:36PM +0800, Jason Wang wrote:
> > Initialise global and static variable to 0 is always unnecessary.
> > Remove the unnecessary initialisations.
>
> Isn't this change also unnecessary?
>
> Initializing to 0 does not affect correctness, or even any kind of
> semantics in any way.
It did make a difference when the kernel was still compiled with
-fcommon (which used to be the GCC default on most configurations, it is
traditional on Unix). No explicit initialiser puts an object in .bss if
you use -fcommon. This matters a bit for data layout.
> The current code is slightly easier to understand.
>
> And changing the code introduces history noise for na gain.
Yup.
This does give you some code golf points of course ;-)
Segher
WARNING: multiple messages have this Message-ID (diff)
From: Segher Boessenkool <segher@kernel.crashing.org>
To: "Michal Suchánek" <msuchanek@suse.de>
Cc: Jason Wang <wangborong@cdjrlc.com>,
lkp@intel.com, linux-kernel@vger.kernel.org, npiggin@gmail.com,
Julia.Lawall@inria.fr, paulus@samba.org, joel@jms.id.au,
linuxppc-dev@lists.ozlabs.org, hbathini@linux.ibm.com
Subject: Re: [PATCH] powerpc: Remove the static variable initialisations to 0
Date: Sat, 23 Jul 2022 14:22:11 -0500 [thread overview]
Message-ID: <20220723192211.GP25951@gate.crashing.org> (raw)
In-Reply-To: <20220723133405.GF17705@kitsune.suse.cz>
On Sat, Jul 23, 2022 at 03:34:05PM +0200, Michal Suchánek wrote:
> Hello,
>
> On Sat, Jul 23, 2022 at 05:24:36PM +0800, Jason Wang wrote:
> > Initialise global and static variable to 0 is always unnecessary.
> > Remove the unnecessary initialisations.
>
> Isn't this change also unnecessary?
>
> Initializing to 0 does not affect correctness, or even any kind of
> semantics in any way.
It did make a difference when the kernel was still compiled with
-fcommon (which used to be the GCC default on most configurations, it is
traditional on Unix). No explicit initialiser puts an object in .bss if
you use -fcommon. This matters a bit for data layout.
> The current code is slightly easier to understand.
>
> And changing the code introduces history noise for na gain.
Yup.
This does give you some code golf points of course ;-)
Segher
next prev parent reply other threads:[~2022-07-23 19:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-23 9:24 [PATCH] powerpc: Remove the static variable initialisations to 0 Jason Wang
2022-07-23 9:24 ` Jason Wang
2022-07-23 13:34 ` Michal Suchánek
2022-07-23 13:34 ` Michal Suchánek
2022-07-23 19:22 ` Segher Boessenkool [this message]
2022-07-23 19:22 ` Segher Boessenkool
2022-07-25 3:27 ` Michael Ellerman
2022-07-25 3:27 ` Michael Ellerman
2022-07-25 16:13 ` Segher Boessenkool
2022-07-25 16:13 ` Segher Boessenkool
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220723192211.GP25951@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=Julia.Lawall@inria.fr \
--cc=hbathini@linux.ibm.com \
--cc=joel@jms.id.au \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lkp@intel.com \
--cc=msuchanek@suse.de \
--cc=npiggin@gmail.com \
--cc=paulus@samba.org \
--cc=wangborong@cdjrlc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.