c++ - 我在玩 VS2017 时发现了一些东西
问题描述
当我尝试学习 throw catch 时,我刚刚编译了我的代码,我发现这个输出是什么意思?
#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();
。
推荐阅读
- asp.net - JWT 声明不在 HttpContext.User.Claims 中
- forms - (Vue) Ant Design 使用 v-decorator 以 ant 的形式显示客户端和服务器端验证
- heroku - 将 Heroku 项目迁移到另一种编程语言
- sql - 甲骨文。在选择中使用 max() 仅获取 1 条记录
- docker - 如何在詹金斯管道中使用焦油?
- php - 无法在 Laravel 显示方法上重定向到另一个网站
- mongodb - 使用 moongoose find() 方法查询数组中的项目
- html - 更改/覆盖 CSS 中 ::after 元素的 z-index
- spring - 春季 Kotlin Postgres
- c# - LINQ 表达式 'DbSet
.Where(p => p.IsValid)' 无法在 EF Core 3 中翻译