我的代码里原本没有任何问题,可以正常编译,但是新声明了一个bool类型的超过内存限制的数组:
bool vis[256][256][256][256][65536];
之后,洛谷的编译器就报错:
No valid executable file was produced by the compiler
/tmp/compiler_5e9egz_x/src: 在函数‘bool judge(char*)’中:
/tmp/compiler_5e9egz_x/src:20:23: 警告:comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
20 | for (int i = 0; i < strlen(ad); i++)
| ~~^~~~~~~~~~~~
/tmp/compiler_5e9egz_x/src:30:49: 警告:comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
30 | if ((ad[i] == '.' || ad[i] == ':') && i == strlen(ad) - 1)
| ~~^~~~~~~~~~~~~~~~~
./ccSc434s.o: in function `_GLOBAL__sub_I_src':
src:(.text.startup+0x3c4): relocation truncated to fit: R_X86_64_PC32 against `.bss'
collect2: 错误:ld 返回 1
说是上面i和strlen()的比较出现了问题。
所以为什么上面加了数组之后下面的整型变量比较会出现问题?(纯属好奇)