简体   繁体   English

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

[英]I found something while playing with VS2017

While I'm trying to learn throw catch I just compiled my code and I found this output what does that mean? 当我尝试学习掷界外球时,我只是编译了代码,发现此输出是什么意思?

    #include "stdafx.h"
    #include <iostream>

    using namespace std;

    void MightGoWrong() {
     bool error = true;

     if (error) {
       throw 8;
     } 
//   -------------------------
     int main()
     {      
        cout << MightGoWrong;               
        return 0;
     }

And output is : 012211A4 what does that mean? 输出是:012211A4是什么意思?

Output 产量

Code

You are not calling your function. 您没有在调用函数。

cout << MightGoWrong; is simply printing the address of the function. 只是简单地打印函数的地址 To call it you should do cout << MightGoWrong(); 要调用它,您应该执行cout << MightGoWrong(); .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM