当尝试为多个平台编译以下(简化)代码时,我发现它在某些方面失败了,即IBM的xlC_r.进一步的调查发现,它也没有在考虑和铿锵声.它使用g ++和Solaris的CC成功编译.
这是代码:
int main()
{
int a1[1];
bool a2[1];
for (int *it = a1, *end = a1+1; it != end; ++it) {
//...
bool *jt = a2, *end = a2+1;
//...
}
}
Run Code Online (Sandbox Code Playgroud)
xlC_r错误:
"main.cpp", line 8.25: 1540-0400 (S) "end" has a conflicting declaration.
"main.cpp", line 6.25: 1540-0425 (I) "end" is defined on line 6 of "main.cpp".
Run Code Online (Sandbox Code Playgroud)
铿锵声:
main.cpp:8:25: error: redefinition of 'end' with a different type
bool *jt = a2, *end = a2+1;
^
main.cpp:6:25: note: previous definition …Run Code Online (Sandbox Code Playgroud)