wat is .bss segment in object file

J

jesjak

hi all,
can any one give me some explanation of "wat is .bss segment in object
file" and what it will contain and difference between data segment
and .bss segment....

help me....

thanks,
jes
 
L

Lew Pitcher

hi all,
can any one give me some explanation of "wat is .bss segment in object
file" and what it will contain and difference between data segment
and .bss segment....

Neither "bss segments" nor "data segments" have anything to do with C. They
are both terms relating to the mechanics of compiling and loading programs in
specific environments.

Typically, a "data segment" is the part of the object module that contains
initialized static data (in C, initialized static variables, string constants,
and other stuff like that), while the "bss segment" ("Block Started by
Symbol") defines the space for unitialized static data.

For example

int main(void)
{
static char abc[12], /* located in BSS segment */
def[] = "1"; /* located in DATA segment */
static int seven; /* located in BSS segment */
static float pi = 3.14159; /* located in DATA segment */
int two = 3; /* not in BSS nor DATA */


strcpy(abc /* as above */,
"Test" /* located in DATA segment */
);

return 0;
}

HTH

--
Lew Pitcher

Master Codewright & JOAT-in-training | Registered Linux User #112576
http://pitcher.digitalfreehold.ca/ | GPG public key available by request
---------- Slackware - Because I know what I'm doing. ------
 
K

Keith Thompson

can any one give me some explanation of "wat is .bss segment in object
file" and what it will contain and difference between data segment
and .bss segment....

I suggest you ask this in a newsgroup that deals with your operating
system. It's not a C language issue.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top