Alexander Mai <[EMAIL PROTECTED]> writes:
>If you don't add the explicit initialization, so I would assume that
>on runtime the program has to dig out what kind of variable it is
>and then assign the 0 value. Isn't there a trade-off between 

I was under the impression that for standards compliance it is sufficient
that the memory bytes are initialized to zero, and because of that you
cannot rely on, for example, static pointer variables being initialized
to 0 (NULL) because as we all know, 0 in pointer context may be something
different than all bits cleared.  (I'd say the same applies to floating
point variables so you probably can only rely on integer and character
types to be properly initialized to 0.)  I'm not a language lawyer, though,
and unfortunately don't have the C89/C99 Standard text at hand so if
somebody here knows The Truth, I'd like to be enlightened on this topic.

I don't expect the C runtime to do any initializing for bss variables,
since the OS already provides cleaned (i.e. all bytes 0) pages on
allocation (well, maybe PC compiler runtimes on pathetic legacy systems
like MS-DOS do this themselves but that doesn't matter here anyways).

mkb

Reply via email to