我在玩VS2017时发现了一些东西

I found something while playing with VS2017

本文关键字:发现 VS2017      更新时间:2023-10-16

当我试图学习投掷捕获时,我刚刚编译了我的代码,我发现这个输出是什么意思?

#include "stdafx.h"
#include <iostream>
using namespace std;
void MightGoWrong() {
bool error = true;
if (error) {
throw 8;
} 
//   -------------------------
int main()
{      
cout << MightGoWrong;               
return 0;
}

输出是:012211A4 这是什么意思?

输出

法典

你没有调用你的函数。

cout << MightGoWrong;只是打印函数的地址。要称呼它,您应该cout << MightGoWrong();.