Patch: set value of static variables in cipher/random.c
    Christian Biere 
    christianbiere at gmx.de
       
    Fri Jul  7 17:36:55 CEST 2006
    
    
  
haypo at inl.fr wrote:
> I'm not sure, but I think that a static variable have "undefined value".
> So I don't understand how the code is working without value initialization
This is from C99 but this hasn't changed since C89:
"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."
-- 
Christian
    
    
More information about the Gcrypt-devel
mailing list