调试器在命名空间中显示错误的静态int值 [英] Debugger shows wrong value for static int in a namespace

查看:96
本文介绍了调试器在命名空间中显示错误的静态int值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你有一个带有静态int的命名空间

Hi have a namespace with a static int

命名空间ms

{

static int DISPLAY = 3;

static int DISPLAY = 3;

void run();

void setLevel(int lvl) ;

void run();
void setLevel(int lvl);

}

void run()

{

std :: cout< ;<显示<< std :: endl;

}



我将等级设置为4.运行"run"功能打印"4"。但是在调试VS"Autos"时窗口显示DISPLAY仍然具有值3.



为什么调试器错误? 

void run()
{
std::cout << DISPLAY << std::endl;
}

I set the level to 4. Running the "run" function prints "4". But when debugging the VS "Autos" window shows that DISPLAY still has a value of 3.

Why is the debugger wrong? 

推荐答案

你把断点放在哪里了?请确保哪个是当前上下文,"运行"&功能或"名称空间ms "?

参考主题:  https://stackoverflow.com/a/18126643/9125096

Reference thread: https://stackoverflow.com/a/18126643/9125096

 

问候,

Fletcher


这篇关于调试器在命名空间中显示错误的静态int值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆