编译器警告 [英] Compiler Warnings

查看:90
本文介绍了编译器警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是c和gcc的新手。我想知道是否有人可以指向一个网页

或书中有警告信息列表及其含义。


警告是无论你使用什么编译器,它们都相同,或者它们对于每个编译器是不同的?b $ b不同?我已经浏览了整个gcc网站,但是我没有找到任何可以解释警告内容的东西。


如果有人可以参加时间帮助我并指导我一些信息

关于这个,我会赞美它。


谢谢

解决方案

" News" < JA **** @ hotmail.com>写道:

我是c和gcc的新手。我想知道是否有人可以指向一个网页
或书籍,其中包含警告信息列表及其含义。


与某些编译器的警告不同,GCC'的意思是

不言自明。我知道,没有地方可以找到你想要的解释。


如果有特定的警告,或者很少,你想要

解释,clc是个好问的地方。请注意,clc是

一般不适合询问有关特定

编译器的问题,但警告往往更多关于C而不是关于

编译器。

无论你使用什么编译器,警告是否相同,或者它们对于每个编译器是否不同?我查看了整个gcc网站,但是我找不到任何可以解释警告内容的东西。




每个编译器都有不同的警告。

-

int main(void){char p [] =" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv wxyz。\

\ n", * q =" kl BIcNBFr.NKEzjwCIxNJC" ;; int i = sizeof p / 2; char * strchr(); int putchar(\

); while(* q){i + = strchr( p,* q ++) - p; if(i> =(int)sizeof p)i- = sizeof p-1; putchar(p [i] \

);} return 0;}


Ben Pfaff写道:



每个编译器都有不同的警告。




这在两种不同的意义上是正确的:首先,对于给定条件发出的实际文本可能是不同的。第二,选择

是否发出某些条件的警告可能会有所不同。


换句话说,导致一个编译器生成一个代码的代码警告可能

导致不同的编译器产生不同的警告或没有警告




标准要求某些条件为了生成诊断,所以

某些条件必须从

符合标准的编译器中唤起某种形式的警告。


- 凯文

-

我的电子邮件地址有效,但会定期更改。

要联系我,请使用最近发布的地址。


Ben Pfaff写道:

" News" < JA **** @ hotmail.com>写道:

我是c和gcc的新手。我想知道是否有人可以指向一个网页
或书中有警告信息列表及其含义。



与某些编译器不同'警告,海湾合作委员会'应该是不言自明的。我知道,没有任何地方有你正在寻找的解释。




IBM,至少对于大型机而言,以及即使对于其他系统,也有一个传统的提供描述给定的b / b
程序可能产生的所有消息的手册。通常它会比打印消息更详细地描述原因,并建议采取行动。


可能有其他公司有类似的系统,但它是不是很常见的
。虽然我相信早期的微软编译器

可能已经完成了它。


- glen


blockquote>

I''m new to c and gcc. I was wondering if anyone can point me to a web page
or book that has a list of the warning messages and their meanings.

Are the warnings the same no matter what compiler you use, or are they
different for each compiler? I have looked all over the gcc web site, but I
can''t find anything that explains what the warnings are.

If someone could take the time to help me out and direct me to some info
about this, I''d appriciate it.

Thanks

解决方案

"News" <ja****@hotmail.com> writes:

I''m new to c and gcc. I was wondering if anyone can point me to a web page
or book that has a list of the warning messages and their meanings.
Unlike some compilers'' warnings, GCC''s are meant to be
self-explanatory. There isn''t a place, that I know of, which has
the explanations you are looking for.

If there is a specific warning, or a few, that you would like
explained, c.l.c is a good place to ask. Note that c.l.c is
generally not the right place to ask questions about specific
compilers, but warnings tend to be more about C than about
compilers.
Are the warnings the same no matter what compiler you use, or are they
different for each compiler? I have looked all over the gcc web site, but I
can''t find anything that explains what the warnings are.



Every compiler has different warnings.
--
int main(void){char p[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv wxyz.\
\n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int putchar(\
);while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof p-1;putchar(p[i]\
);}return 0;}


Ben Pfaff wrote:



Every compiler has different warnings.



This is true in two different senses: first, the actual text that is
emitted for a given condition may be different. Second, the choice
whether or not to emit a warning for some condition may be different.

In other words, code that causes one compiler to generate a warning may
cause a different compiler to generate a different warning or no warning
at all.

The standard requires certain conditions to generate a diagnostic, so
some conditions must evoke some form of warning from a
standard-compliant compiler.

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.


Ben Pfaff wrote:

"News" <ja****@hotmail.com> writes:

I''m new to c and gcc. I was wondering if anyone can point me to a web page
or book that has a list of the warning messages and their meanings.


Unlike some compilers'' warnings, GCC''s are meant to be
self-explanatory. There isn''t a place, that I know of, which has
the explanations you are looking for.



IBM, at least for the mainframes, and even for other systems, has a
tradition of supplying manuals describing all the messages a given
program could generate. Usually it will describe in more detail than
the printed message the cause, and suggested action to take.

There may be other companies that have a similar system, but it is
not so common. Though I believe that early microsoft compilers
may have done it.

-- glen


这篇关于编译器警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆