简体   繁体   中英

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(){
}

static inside a class means that the member or method in question does not operate on an object, ie 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, ie things outside the current compilation unit cannot link to it.

Two entirely different things.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM