在编译此代码时
#include <math.h>
double *y0;
int main()
{
return 0;
}
对于来自最新debian-sid的gcc 13.2.0
,我得到以下错误:
gcc -o a.out proof.c -Wall -lm
proof.c:3:9: error: 'y0' redeclared as different kind of symbol
3 | double *y0;
| ^~
In file included from /usr/include/features.h:490,
from /usr/include/x86_64-linux-gnu/bits/libc-header-start.h:33,
from /usr/include/math.h:27,
from proof.c:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:223:1: note: previous declaration of 'y0' with type 'double(double)'
223 | __MATHCALL (y0,, (_Mdouble_));
| ^~~~~~~~~~
make: *** [Makefile:6: proof] Error 1
请注意,如果我用不同的名称替换*y0
,例如*x0
,它不会有任何问题.
显然,mathlib
的名称存在冲突,但这正常吗?这种冲突应该是可能的,还是只是一个漏洞?