[英]how to print the following information out without getting this warning?
我有以下代码:
#define HELLO
"this is a command to ........." //this macros is very long, and it is greater than length 509
然后我使用printf(HELLO);
打印出来,但是我收到以下警告:
警告:字符串长度'526'大于长度'509'ISO C90编译器需要支持,我知道字符串太长,大于509,但是如何删除此警告?
如果可能,可以使用兼容C99的编译器,C99中的限制为4,095个字符。
如果失败,则在运行时(一次)将字符串构建为全局字符数组。
1)将其分成2个字符串#define a“ abc” #define b“ def” #define c(ab)现在都可以使用printf(ab)
或printf(c)
2)仅抑制警告,(代码在起作用,不是吗?:)))( http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html )
3)哦,刚才看到了第三个选项,使用不同的标准
第一个没有用,它不会解决问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.