public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "J . A . Magallon" <jamagallon@able.es>
To: Rusty Russell <rusty@linuxcare.com.au>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] removal of "static foo = 0" from drivers/ide (test11)
Date: Sat, 25 Nov 2000 00:13:51 +0100	[thread overview]
Message-ID: <20001125001351.A1342@werewolf.able.es> (raw)
In-Reply-To: <Pine.LNX.4.21.0011212300590.950-100000@penguin.homenet> <20001123110203.EB8A8813D@halfway.linuxcare.com.au>
In-Reply-To: <20001123110203.EB8A8813D@halfway.linuxcare.com.au>; from rusty@linuxcare.com.au on Thu, Nov 23, 2000 at 12:01:53 +0100


On Thu, 23 Nov 2000 12:01:53 Rusty Russell wrote:
> 
> What irritates about these monkey-see-monkey-do patches is that if I
> initialize a variable to NULL, it's because my code actually relies on
> it; I don't want that information eliminated.
> 

What I understood from the previous answer from Tigran is that you can
avoid initializations to ZERO or NULL, because the BSS is zeroed (ie, all
variables you declare static os global in a module are zeroed) at
kernel start.

As I understand from compiler working, if you put a statement like
int a = 0;
int b = 0;
all variables that have an initial value are stored contiguous in the
data segment of the executable and an image of their initial values has
to be stored with the binary. So if a program like

int a[16384];
int main() {}

gives a binary of 13k, if you write it as

int a[16384] = {0};
int main() {}

it has to store the 64k of a, just to put a 0 in the first place and
make the exec size to 78k.

ANSI rules for C say that uninitialized vars get a 0, but you can't trust
on the ANSI behaviour of a compiler.

Obviuosly, you have to leave your initializations to 7 or -1 in place.

-- 
Juan Antonio Magallon Lacarta                                 #> cd /pub
mailto:jamagallon@able.es                                     #> more beer

Linux 2.2.18-pre23-vm #3 SMP Wed Nov 22 22:33:53 CET 2000 i686 unknown

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  parent reply	other threads:[~2000-11-24 23:44 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-21 21:25 [PATCH] removal of "static foo = 0" from drivers/ide (test11) Bartlomiej Zolnierkiewicz
2000-11-21 22:55 ` J . A . Magallon
2000-11-21 23:04   ` Tigran Aivazian
2000-11-21 23:18     ` J . A . Magallon
2000-11-21 23:26       ` Tigran Aivazian
2000-11-21 23:30         ` J . A . Magallon
2000-11-23 11:01     ` Rusty Russell
2000-11-24 21:40       ` Vojtech Pavlik
     [not found]         ` <20001128031933.52DB981F5@halfway.linuxcare.com.au>
2000-11-28  8:59           ` Vojtech Pavlik
2000-11-24 23:13       ` J . A . Magallon [this message]
2000-11-25 12:01         ` Russell King
2000-11-25 11:50       ` Russell King
2000-11-25 23:56       ` Bartlomiej Zolnierkiewicz
2000-11-22  0:09   ` Jeff Garzik
2000-11-22 11:40   ` Russell King
  -- strict thread matches above, loose matches on Subject: below --
2000-11-28 20:58 David Hinds
2000-11-28 21:08 ` Tigran Aivazian
2000-11-28 23:53   ` Peter Samuelson
2000-11-29  3:23     ` Keith Owens
2000-11-29  3:35       ` Peter Samuelson
2000-11-29  7:48     ` Tigran Aivazian
2000-11-29 14:00       ` Peter Samuelson
2000-11-29 14:08         ` Tigran Aivazian
2000-11-29 16:16 Darryl Miles
2000-11-29 23:54 ` Russell King

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=20001125001351.A1342@werewolf.able.es \
    --to=jamagallon@able.es \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@linuxcare.com.au \
    /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