What happens to unused function return values?

后端 未结 7 1592
太阳男子
太阳男子 2020-12-10 16:48

If I have a program:

#include 

using namespace std;

int TestIntReturn(int &x, int &y)
{
    x = 1000;
    y = 1000;
    return x+y;         


        
相关标签:
7条回答
  • 2020-12-10 17:36

    In the case of primitive types, nothing happens to it. It is just ignored. In the case of class types, the returned object will be destructed, without anything else happening to it.

    0 讨论(0)
提交回复
热议问题