lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
From: silvio at big.net.au (silvio@....net.au)
Subject: Re: C initialization of static objects (was: ALERT ALERT ALERT! google under attack ALERT ALERT ALERT!)

On Sun, Sep 15, 2002 at 09:06:57AM -0500, Jacques A. Vidrine wrote:
> _The C Programming Language_, 2nd edition says it most clearly on
> p219:  ``A static object not explicitly initialized is initialized as
> if it (or its members) were assigned the constant 0.''
>
> ISO/IEC 9899:1999 (C99) is a bit more verbose (section 6.7.8
> paragraph 10):  ``If an object that has static storage duration is
> not initialized explicitly, then: if it has pointer type, it is
> initialized to a null pointer; if it has arithmetic type, it is
> initialized to (positive or unsigned) zero; if it is an aggregate,
> every member is initialized (recursively) according to these rules;
> if it is a union, the first named member is initialized (recursively)
> according to these rules. ''
> 
> > must suck to port :)
> 
> Yes, it does, but not for this reason.
> 
> Cheers,

heh. thanks for the quick reply (which also happens to be accurate!) ;-)

Looking at the isoc specs you mention, you are infact correct here :)
It appears I have been misinformed on this topic! heh. thanks for clarifaction.

erm.. this is something interesting however.

For static storage initialization of a union, then yes, the specs say the
first member is initializated..  but the size of a union is not necessary the
size of the first member, but a size sufficient to contain the largest of its
members (6.7.2.1 - 14).

does this seem true?


Personally though, without even looking at the specs.. I much prefer all
initialization to be explicit :)

OK.. its obvious the C specifications are not my strong point, and to be
honest, I've never fully read them.. so please go easy on me :)

--
Silvio

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ