cyrux
cyrux

Reputation: 243

C++ calling a static function from another static function

have a static function in a header file

    class Diagnostics {
    public:


    static void functionA(){
    }

    static void functionB(){
    some code //works fine until enters the loop below
    variable_name // works fine here.
    if (condition){ // 
    variable_name; // after condition is met , i step in here, debugger cannot examine
                   // the vairable_name which was fine above. right after i try to step                      over , i get SIGSEV error
    some_code; // doesnt even come here. Process exited with SIGSEV
    function C(); // tried using classname::functionC , didnt work either

        }
    }

static void functionC(){
}

Upvotes: 4

Views: 3755

Answers (2)

cyrux
cyrux

Reputation: 243

I dont know the problem was. Works fine now. initially happened while I was debugging. Then i just executed instead of debugging , worked fine. then i tried debugging again , which worked fine this time.

Upvotes: 0

Mike DeSimone
Mike DeSimone

Reputation: 42805

static inside a class means that the member or method in question does not operate on an object, i.e. it doesn't define this, but it is still in the class's namespace.

static outside a class means what it means in C: the variable or function does not have external linkage, i.e. things outside the current compilation unit cannot link to it.

Two entirely different things.

Upvotes: 5

Related Questions