From: Benny Halevy <bhalevy@panasas.com>
To: Bernd Petrovitsch <bernd@firmix.at>
Cc: Andreas Westin XX <andreas.xx.westin@ericsson.com>,
linux-kernel@vger.kernel.org
Subject: Re: checkpatch.pl and statics
Date: Sun, 16 Mar 2008 18:23:55 +0200 [thread overview]
Message-ID: <47DD499B.1050503@panasas.com> (raw)
In-Reply-To: <1205676819.3815.48.camel@gimli.at.home>
On Mar. 16, 2008, 16:13 +0200, Bernd Petrovitsch <bernd@firmix.at> wrote:
> On Son, 2008-03-16 at 15:34 +0200, Benny Halevy wrote:
>> On Mar. 13, 2008, 17:43 +0200, Bernd Petrovitsch <bernd@firmix.at> wrote:
>>> On Don, 2008-03-13 at 16:09 +0100, Andreas Westin XX wrote:
>>> [....]
>>>> I ran checkpatch.pl on a piece of code I wrote and besides all the other
>>>> warnings/errors it complained about a static pointer being initialised
>>>> to NULL/0. I fixed it but I'm curious as to why this is not permitted ?
>>> Because "uninitialized" data is automatically initialized wit 0. An
>>> explicit initialization with 0/NULL wastes space in the kernel image.
>> gcc (at least version >= 4.1.2) seems to smarter than that. It
>
> That's good news (and new to me too).
>
>> doesn't seem to put data initialized to zero in the initialized data
>> segment but rather adds it to the uninitialized data. That said,
>> initializing statically allocated data to zero is superfluous in C
>> and should be avoided for style/elegance reasons as well.
>
> Well, one can discuss endlessly about style and elegance ....
Heh, that's what checkpatch is all about, isn't it? :)
Real errors and warnings should be caught and reported by the compiler...
Benny
>
> Bernd
prev parent reply other threads:[~2008-03-16 16:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-13 15:09 checkpatch.pl and statics Andreas Westin XX
2008-03-13 15:43 ` Bernd Petrovitsch
2008-03-16 13:34 ` Benny Halevy
2008-03-16 14:13 ` Bernd Petrovitsch
2008-03-16 16:23 ` Benny Halevy [this message]
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=47DD499B.1050503@panasas.com \
--to=bhalevy@panasas.com \
--cc=andreas.xx.westin@ericsson.com \
--cc=bernd@firmix.at \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox