Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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(){
}
like image 736
cyrux Avatar asked Sep 01 '25 21:09

cyrux


1 Answers

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.

like image 84
Mike DeSimone Avatar answered Sep 04 '25 07:09

Mike DeSimone