Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8362219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:53:31+00:00 2026-06-09T11:53:31+00:00

Lets consider two cases: 1.) Static global variables. When i generate map file i

  • 0

Lets consider two cases:

1.) Static global variables.
When i generate map file i can’t find static global variables in .bss or .data section.

2.) Static members

    #include <stdio.h>
    #include <iostream>
    #include <vector>
    #include <list>
    #include <algorithm>

    using namespace std;

    class Tree {
        struct Node {
            Node(int i, int d): id(i), dist(d) {}
            int id;
            int dist; // distance to the parent node
            list<Node*> children;
        };

        class FindNode {
            static Node* match;
            int id;
        public:
            FindNode(int i): id(i) {}
            Node* get_match()
            {
                return match;
            }

            bool operator()(Node* node)
            {
                if (node->id == id) {
                    match = node;
                    return true;
                }
                if (find_if(node->children.begin(), node->children.end(), FindNode(id)) != node->children.end()) {
                    return true;
                }
                return false;
            }
        };

        Node* root;

        void rebuild_hash();
        void build_hash(Node* node, Node* parent = 0);

        vector<int> plain;
        vector<int> plain_pos;
        vector<int> root_dist;
        bool hash_valid; // indicates that three vectors above are valid

        int ncount;
    public:
        Tree(): root(0), ncount(1) {}
        void add(int from, int to, int d);
        int get_dist(int n1, int n2);

    };

    Tree::Node* Tree::FindNode::match = 0;
...

Variable Tree::FindNode::match is static member of FindNode class. And this variable is presented in map file in bss section. Why so??

 *(.bss)
 .bss           0x00408000       0x80 C:\Users\Администратор\Desktop\яндекс\runs\runs\\000093.obj
                0x00408000                _argc
                0x00408004                _argv
                0x00408020                Tree::FindNode::match

I use MinGW, os windows 7. All object files obtained by g++ …cpp -o …obj command, map file obtained by ld ….obj -Map …..map command

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:53:33+00:00Added an answer on June 9, 2026 at 11:53 am

    Global variables are already in the static memory, so C re-used the existing keyword static to make a global variable “file-scoped”, and C++ followed the suite. The keyword static hides your global from the map file.

    Static members, on the other hand, are class-scoped, therefore they need to be available in the map file: other modules need to be able to access the static members of your class, both member functions and member variables, even if they are separately compiled.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For my question lets consider the following sample table data: ProductID    ProductName    Price   Category 1                Apple                 5.00       Fruits
Let's consider the following scenario: a function which can generate code colors from white
Lets consider some cases: _windsor.Register(Component.For<IProductServices>().ImplementedBy<ProductServices>().Interceptors(typeof(SomeInterceptorType)); In this case, when I ask for a IProductServices
I have a question about HTTPService and the data it returns. Well lets consider
Let's consider two tables: First: Id Data 1 asd 2 buu And Second: UPD:
Lets consider two almost identical codes: First for (int k=0;k<1000;k++) { for (int i=0;i<600;i++)
Lets consider following two codes First: for (int i=0;i<10000000;i++) { char* tab = new
let's consider two views that use the same layout composed of: A left column
Lets consider the following linq statement. var ctx = new MoviesContext(); var movies =
For the scenario lets consider Car to be the highest SWF(stage) inside I load

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.