c++/c遇到的warnings(更新中)

1.PAT做题之warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]

百度之

https://www.e-learn.cn/content/wangluowenzhang/88661

我觉得比较简单的方法是:

(void)scanf("%d",&t);

 好吧,简单但是并没有用。。。

a.cpp: In function ‘int main()’:
a.cpp:24:28: error: invalid operands of types ‘void’ and ‘int’ to binary ‘operator!=’


while((void)scanf("%d",&n)!=EOF)

declared with attribute warn_unused_result [-Wunused-result]

 

原来只是

a.cpp:29:45: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%llu%d%d",&s[i].a,&s[i].b,&s[i].c);

 

...

 

上一篇:javascript – getAttributeNode()和getAttributeNodeNS()警告


下一篇:c – 如何使用gcc抑制boost :: thread警告?