I met a strange issue. The c++ calling convention seems different from win/linux from macosx
The following code's behavior is different on MacOSX/linux/Win7 (64bit)
MacOSX: Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Linux: gcc version 4.8.4
Win7: VS2015
On Win7/Linux:
this is method1
this is method2
this is method3
this is method4
this is method5
this is method6
this is method7
this is method8
this is method9
on MacOsx
this is method9
this is method8
this is method7
this is method6
this is method5
this is method4
this is method3
this is method2
this is method1
Here is the code:
#include <iostream>
int method1(){
std::cout << "this is method1" << std::endl ;
return 1;
}
int method2(){
std::cout << "this is method2" << std::endl;
return 1;
}
int method3(){
std::cout << "this is method3" << std::endl;
return 1;
}
int method4(){
std::cout << "this is method4" << std::endl;
return 1;
}
int method5(){
std::cout << "this is method5" << std::endl;
return 1;
}
int method6(){
std::cout << "this is method6" << std::endl;
return 1;
}
int method7(){
std::cout << "this is method7" << std::endl;
return 1;
}
int method8(){
std::cout << "this is method8" << std::endl;
return 1;
}
int method9(){
std::cout << "this is method9" << std::endl;
return 1;
}
void caller(int, int,int, int,int, int,int, int,int){
}
int main(){
caller(method1(), method2(),method3(), method4(),method5(), method6(),method7(), method8(),method9());
return 0;
}