All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Jarosch <thomas.jarosch@intra2net.com>
To: hadi@cyberus.ca
Cc: Patrick McHardy <kaber@trash.net>,
	Jan Engelhardt <jengelh@medozas.de>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] libxtables: Dont initialize global xt_params
Date: Thu, 12 Feb 2009 16:09:42 +0100	[thread overview]
Message-ID: <200902121609.43664.thomas.jarosch@intra2net.com> (raw)
In-Reply-To: <1234448162.3271.1.camel@dogo.mojatatu.com>

Hi Jamal,

On Thursday, 12. February 2009 15:16:02 jamal wrote:
> commit 7aad144ecaf7603b17af5372886fe491c3bc6a2f
> Author: Jamal Hadi Salim <hadi@cyberus.ca>
> Date:   Wed Feb 11 16:19:30 2009 -0500
>
>     Dont initialize global xt_params
>     To quote Jan Engelhardt <jengelh@medozas.de>
>     "
>     Do not initialize static members - this takes up extra space
>     and adds no benefit. (zeroed anyway even in .bss)
>     "
>
>     Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
>
> diff --git a/xtables.c b/xtables.c
> index 8e28d5e..114a393 100644
> --- a/xtables.c
> +++ b/xtables.c
> @@ -48,7 +48,7 @@
>
>  void basic_exit_err(enum xtables_exittype status, const char *msg, ...)
> __attribute__((noreturn, format(printf,2,3)));
>
> -struct xtables_globals *xt_params = NULL;
> +struct xtables_globals *xt_params;

Thanks for your patch. Did you know about zeroing of .bss before?

I see two possible drawbacks using this style:

1. Other people which don't know this "trick" will think
the variable is not initialized -> Hard to read.

2. If that variable gets moved f.e. inside a function, it will become 
uninitialized. Also I'm not sure if the savings are even measurable...

Just my two cents
Thomas


  reply	other threads:[~2009-02-12 15:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-12 14:16 [PATCH] libxtables: Dont initialize global xt_params jamal
2009-02-12 15:09 ` Thomas Jarosch [this message]
2009-02-12 15:14   ` Jan Engelhardt
2009-02-12 15:41     ` Thomas Jarosch
2009-02-13 13:49       ` jamal
2009-02-13 18:11         ` Thomas Jarosch
2009-02-16  4:51       ` Philip Craig
2009-02-16 10:38         ` Patrick McHardy
2009-02-17 14:46           ` Thomas Jarosch
2009-02-17 14:54             ` Patrick McHardy
2009-02-12 16:39 ` jamal

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=200902121609.43664.thomas.jarosch@intra2net.com \
    --to=thomas.jarosch@intra2net.com \
    --cc=hadi@cyberus.ca \
    --cc=jengelh@medozas.de \
    --cc=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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 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.