对于相同的代码,使用CC以及cc编译的目标文件结果函数名变化。
C++对于违反ODR的程序链接时做的不好。
For example,
//static
void fun(int a)
{
}
int main()
{
return 0;
}
Using CC,
- uncomment static,
[5] | 16| 64|FUNC |LOCL |0 |2 |void fun(int)
[__1cDfun6Fi_v_] (C++ Name Mangling)
- comment static,
[12] | 16| 64|FUNC |GLOB |0 |2 |void fun(int)
[__1cDfun6Fi_v_] (C++ Name Mangling)
Using cc,
- uncomment static,
[39] | 68480| 24|FUNC |LOCL |0 |8 |fun
- comment static,
[49] | 68504| 24|FUNC |GLOB |0 |8 |fun