我是靠谱客的博主 精明发箍,这篇文章主要介绍VC++ 2022 Release 重大BUG,现在分享给大家,希望可以做个参考。

#include <iostream>
using namespace std;

bool ctrl[10]={1};

int main(void)
{
	bool state(false);

	int j = 0;

	do
	{
		state = false;
		for (int i = 0; i < sizeof(ctrl); i++)
		{
			//j++;
			if (!ctrl[i])
			{
				//cout << "死循环" << endl;
				state = true;
				break;
			}
		}

	} while (state);

	cout << j << " " << "不正常的运行!" << endl;

	cin.get();

	return 0;
}

Release 模式下 控制台输出了 结果 “0 不正常的运行!”

Debug 下没有任何输出,因为本身就是个死循环。

不知道为什么 Release 为什么这样优化!这是VC的BUG吗?

 

最后

以上就是精明发箍最近收集整理的关于VC++ 2022 Release 重大BUG的全部内容,更多相关VC++内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(97)

评论列表共有 0 条评论

立即
投稿
返回
顶部