vendredi 23 septembre 2016

What is the difference between VC++ and G++ with this code? [duplicate]

This question already has an answer here:

I've question with this code.

#include <iostream>
using namespace std;
int issue1(int c);
void issue2(int a,int b);
int main()
{
    auto digit = 2;
    issue2(++digit,issue1(digit));
    return 0;
}
int issue1(int c){
    return c+1;
}
void issue2(int a,int b){
    cout << a << ", " << b << endl;
}

When i use G++ to compile this prog, the result is 3,3 .Somehow, using Visual Studio C++11 to compile, the result is 3,4. But why?Isn't my code wrong?

Thanks!

Aucun commentaire:

Enregistrer un commentaire