[comp.lang.c] BSS data segment

chad@lakesys.UUCP (D. Chadwick Gibbons) (07/22/89)

	I've seen the BSS data segment mentioned in several books.  Some
even have indepth sections describing how to create
efficently-initalizing programs by taking advantage of this feature.
However, I'm wondering if this is a C feature, or a phenonmenon of the
UNIX/MS-DOS environments.  It's extremely convient to have a section of
code auto-initialized to zero by the run-time system...perhaps a large
amount of global pointers, such as:

char *ptr1, *ptr2, *ptr3.......*ptr999, *ptr1000;

main();

etc, etc.  Things are thus auto-set to NULL, and the need for
initialization elsewhere does not exist.  Handy, indeed.
-- 
D. Chadwick Gibbons, chad@lakesys.lakesys.com, ...!uunet!marque!lakesys!chad

gwyn@smoke.BRL.MIL (Doug Gwyn) (07/23/89)

In article <876@lakesys.UUCP> chad@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.

mark@inmet (08/02/89)

/* Written  6:15 am  Jul 23, 1989 by gwyn@smoke.UUCP in inmet:comp.lang.c */
/* ---------- "Re: BSS data segment" ---------- */
In article <876@lakesys.UUCP> chad@lakesys.UUCP (D. Chadwick Gibbons) writes:
>
>	I've seen the BSS data segment mentioned in several books.  ...
>
/* End of text from inmet:comp.lang.c */

As a new comer to UNIX and C I have always wondered what BSS stands for??



			   mark hertel
			   mark@inmet.com

gregu@pyrnova (Greg Ullmann) (08/05/89)

In article <20900001@inmet> mark@inmet writes:
>
>As a new comer to UNIX and C I have always wondered what BSS stands for??
>

According to "Life with UNIX: A Guide for Everyone", Don Libes & Sandy
Ressler:

	"bss" stands for Block Started by Symbol.  Used by a now obsolete
	IBM assembler, BSS was an assembler pseudo-opcode that filled an
	area of memory with zeros.  That is exactly the effect of the bss
	in a.out files.  The bss is also called the unitialized data.



      -m-------  Greg Ullmann                Phone : (313)973-0932
    ---mmm-----  Pyramid Technology          UUCP  : pyramid.com!pyrnova!gregu
  -----mmmmm--- 
-------mmmmmmm- 

"Comedy is when someone else falls in a manhole and breaks his neck.  
 Tragedy is when I cut my finger."  -Mel Brooks

rns@se-sd.NCR.COM (Rick Schubert ) (08/09/89)

In article <20900001@inmet> mark@inmet writes:
>As a new comer to UNIX and C I have always wondered what BSS stands for??
If you are a newcomer to UNIX and C, how long is this "always"?

(Sorry about the non-technical posting and non-answer, but I thought my
posting might be a nice break from the repetitive answers to this repetitive
question.)

wjr@ftp.COM (Bill Rust) (08/10/89)

In article <2006@se-sd.NCR.COM> rns@se-sd.UUCP (Rick Schubert (AEP)) writes:
>In article <20900001@inmet> mark@inmet writes:
>>As a new comer to UNIX and C I have always wondered what BSS stands for??
>If you are a newcomer to UNIX and C, how long is this "always"?
>
>(Sorry about the non-technical posting and non-answer, but I thought my
>posting might be a nice break from the repetitive answers to this repetitive
>question.)


Give the guy a break. He asked a simple question and about 15 people
were nice enough to respond. I thought that the purpose of this system
was to disseminate information. If the question isn't up to your
standards, fine, ignore it, but don't go beating up people because of
it. Yes, some questions should have the response RTFM, but trivia like
this frequently isn't in TFM and sometimes, it is helpful to know what
it means. In short, if you want to respond, respond, otherwise don't
waste the bandwidth.

Bill Rust (wjr@ftp.com)