Yo Hal!

On Thu, 29 Aug 2019 14:06:25 -0700
Hal Murray via devel <devel@ntpsec.org> wrote:

> >> By "floating", you mean uninnitialized?  In C that's going to mean
> >> it's   
> false
> 
> > Yes. My understanding of C is that anything not explicitly set has
> > whatever random value happens to be in that memory location.
> > Possibly  changed if certain unknown compiler options are chosen.   
> 
> I thought global variables were initialized to zero.


C11 states, page 12, section 5.1.2.2:

"All objects of static storage duration shell be initialized (set to
their initial values) before program startup.  The manner and timing of
such initializations are otherwise unspecified."

In this case, as defined in 6.2.4, "static" just means always allocated
(not on the stack, etc.).

So, IMHO, you can't expect zeros.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        g...@rellim.com  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can't measure it, you can't improve it." - Lord Kelvin

Attachment: pgpNo2lmzSnw1.pgp
Description: OpenPGP digital signature

_______________________________________________
devel mailing list
devel@ntpsec.org
http://lists.ntpsec.org/mailman/listinfo/devel

Reply via email to