开发者

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){ // 
 开发者_Python百科   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, 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜