[prev in list] [next in list] [prev in thread] [next in thread] 

List:       netbsd-current-users
Subject:    Re: shutdown(8) Heisenbug?
From:       Frederick Bruckman <fb () enteract ! com>
Date:       1999-09-30 8:25:23
[Download RAW message or body]

On Thu, 30 Sep 1999, Dave Huang wrote:

> On Thu, 30 Sep 1999, Frederick Bruckman wrote:
> > That is what I'm saying, that you should never rely on the value of an
> > uninitialized variable. At least, that's what I always thought. I
> > think maybe variables are automatically initialized to zero in C++ and
> > Java, but not C.
> 
> Static variables and global variables are automatically initialized to
> 0... automatic variables aren't initialized to anything, and must be
> initialized before you do anything with 'em.

Ahh... 

FWIW, on i386-1.4.1, _dofast is in the bss/data segment (I'm confused,
nm says bss, objdump says .data) and is zero'd there by the linker.

fredb@handy-> nm shutdown | grep dofast
0002796c b _dofast
fredb@handy-> objdump --disassemble --full-contents shutdown|grep 27960
 27960 00000000 00000000 00000000 00000000  ................
    17e3:       c6 05 60 79 02  movb   $0x0,0x27960

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic