BSS data segment
Doug Gwyn
gwyn at smoke.BRL.MIL
Sun Jul 23 20:15:43 AEST 1989
In article <876 at lakesys.UUCP> chad at lakesys.UUCP (D. Chadwick Gibbons) writes:
> I've seen the BSS data segment mentioned in several books. ...
>However, I'm wondering if this is a C feature, or a phenonmenon of the
>UNIX/MS-DOS environments. ...
>char *ptr1, *ptr2, *ptr3.......*ptr999, *ptr1000;
>etc, etc. Things are thus auto-set to NULL, and the need for
>initialization elsewhere does not exist. Handy, indeed.
The C language guarantees that objects with static storage duration
that are not explicitly initialized will be automatically initialized
to zero values of the appropriate types before the program begins
execution. How this is accomplished is up to the implementation;
fortunate ones can use BSS segments, demand-load zero-fill pages, or
some other convenient and efficient mechanism. However, implementations
where some zero-valued data types (e.g. pointers) aren't represented by
all zero bytes need to work harder to set up the initial object values.
More information about the Comp.lang.c
mailing list