wat is .bss segment in object file

Discussion in 'C Programming' started by jesjak@gmail.com, May 23, 2007.

  1. Guest

    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
    , May 23, 2007
    #1
    1. Advertising

  2. Kenny McCormack, May 23, 2007
    #2
    1. Advertising

  3. Lew Pitcher Guest

    wrote:
    > 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. ------
    Lew Pitcher, May 23, 2007
    #3
  4. On 23 May 2007 07:50:49 -0700, jesjak@...com wrote:
    >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....


    http://en.wikipedia.org/wiki/.bss


    --
    Roland Pibinger
    "The best software is simple, elegant, and full of drama" - Grady Booch
    Roland Pibinger, May 23, 2007
    #4
  5. writes:
    > 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.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
    Keith Thompson, May 23, 2007
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. termiflyer
    Replies:
    4
    Views:
    625
    S.Tobias
    Oct 10, 2005
  2. onkar

    variable allocated from stack/bss ??

    onkar, Nov 29, 2006, in forum: C Programming
    Replies:
    148
    Views:
    2,251
    Dave Thompson
    Dec 18, 2006
  3. karthikbalaguru

    Heap & BSS

    karthikbalaguru, Aug 21, 2007, in forum: C Programming
    Replies:
    13
    Views:
    904
    Ravishankar S
    Aug 23, 2007
  4. text,data and bss

    , Nov 16, 2008, in forum: C Programming
    Replies:
    27
    Views:
    7,160
  5. Francis Moreau

    Is my global part of BSS ?

    Francis Moreau, Jan 30, 2009, in forum: C Programming
    Replies:
    2
    Views:
    288
    Kaz Kylheku
    Jan 31, 2009
Loading...

Share This Page