[collectd] Question about static initialization

Florian Forster octo at verplant.org
Thu Aug 14 11:49:56 CEST 2008

Hi Peter,

On Thu, Aug 14, 2008 at 11:25:14AM +0200, Peter Holik wrote:
> Is this not common to all comilers that a static declared variable is
> automatically initialized to 0?

yes, as far as I know static memory is usually initialized to zero, but
the C standard only guarantees that ``its stored value is initialized
only once''. Also, I prefer explicit statements over implicit
mechanisms. With 
  static int foo = 0;
you don't have to know how static variables are initialized - it's right
there. Or, a bit more poetic:
``Programs must be written for people to read, and only incidentally for
  machines to execute.'' -- Abelson and Sussman

Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20080814/ab605569/attachment.pgp 

More information about the collectd mailing list