C++从另一个静态函数调用静态函数
头文件中有一个静态函数
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(){
}
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(){
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
class
中的static
意味着相关成员或方法不对对象进行操作,即它没有定义this
,但它仍在类的命名空间中。类外部的
static
的含义与C 语言中的含义相同:变量或函数没有外部链接,即当前编译单元之外的内容无法链接到它。两种完全不同的东西。
static
inside aclass
means that the member or method in question does not operate on an object, i.e. it doesn't definethis
, 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.