public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Keith Owens <kaos@ocs.com.au>
To: hps@intermeta.de
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net #9
Date: Wed, 30 May 2001 20:30:18 +1000	[thread overview]
Message-ID: <18468.991218618@ocs3.ocs-net> (raw)
In-Reply-To: Your message of "Wed, 30 May 2001 09:32:39 GMT." <9f2enn$jbr$1@forge.intermeta.de>

On Wed, 30 May 2001 09:32:39 +0000 (UTC), 
"Henning P. Schmiedehausen" <mailgate@hometree.net> wrote:
>Andrzej Krzysztofowicz <ankry@green.mif.pg.gda.pl> writes:
>
>>-static char	name[4][IFNAMSIZ] = { "", "", "", "" };
>
>>+static char	name[4][IFNAMSIZ];
>
>Ugh. Sure about that one? the variables have been pointers to zero,
>now they're zero...

Bzzt.  Arrays and pointers are not always equivalent.  This code
defines an area of 4*IFNAMSIZ chars.  The old code then initialised
each IFNAMSIZ chars to the empty string (an array starting with '\0'),
not a pointer to an empty string.  Test file x.c.

#define IFNAMSIZ 7
static char name[4][IFNAMSIZ];
int main(void) { return(0); }

# gcc -g x.c -o x
# gdb x
(gdb) ptype name
type = char [4][7]
(gdb) x name[0]
0x80494f4 <name>:       0x00000000
(gdb) x name[1]
0x80494fb <name+7>:     0x00000000
(gdb) x name[2]
0x8049502 <name+14>:    0x00000000
(gdb) x name[3]
0x8049509 <name+21>:    0x00000000

Zero initialisation via bss works fine.  Try it with 
  static char name[4][IFNAMSIZ] = {"", "", "", ""};
and you get exactly the same results, at the expense of more disk space
and time to load.  Not much extra I know, but it all adds up.


  parent reply	other threads:[~2001-05-30 10:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-30  0:48 [PATCH] net #9 Andrzej Krzysztofowicz
2001-05-30  1:04 ` Jean Tourrilhes
2001-05-30  1:13   ` Jeff Garzik
2001-05-30  1:25     ` Jean Tourrilhes
2001-05-30  1:47       ` Jeff Garzik
2001-05-30  2:01         ` Jean Tourrilhes
2001-05-30  2:13           ` Jeff Garzik
2001-05-30  2:25             ` Jean Tourrilhes
2001-05-30 16:35           ` Hermann Himmelbauer
2001-05-30  2:13         ` Jean Tourrilhes
2001-05-30  2:17           ` Jeff Garzik
2001-05-30  9:33         ` Henning P. Schmiedehausen
2001-05-30 22:28       ` Pavel Machek
2001-05-30  9:32 ` Henning P. Schmiedehausen
2001-05-30 10:28   ` Andrzej Krzysztofowicz
2001-05-30 10:30   ` Keith Owens [this message]
2001-05-30 10:43     ` Henning P. Schmiedehausen
2001-05-30 10:30   ` Jeff Garzik

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=18468.991218618@ocs3.ocs-net \
    --to=kaos@ocs.com.au \
    --cc=hps@intermeta.de \
    --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