我从gcc收到以下警告:
labs.c:760:2: error: array subscript has type ‘char’ [-Werror=char-subscripts]
wrbuf[cmdlen++]=(unsigned char)(basictoken[from]>>8);
^
cc1: all warnings being treated as errors
使用gdb进行调试时,它会报告类似类型的两面:
760 wrbuf[cmdlen++]=(unsigned char)(token[from]>>8);
(gdb) whatis wrbuf[cmdlen]
type = unsigned char
(gdb) whatis (unsigned char)(token[from]>>8)
type = unsigned char
为什么会出现此警告? 这让我感到不安,因为如果我想为ctypes提供可用的格式,警告就会变成错误。
答案 0 :(得分:3)
error: array subscript has type ‘char'
它告诉你数组下标,cmdlen
或from
。
如何定义cmdlen
和from
?其中一个是char吗?我怀疑......