这个警告意味着什么? [英] What does this warning means?

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

问题描述

大家好,

我是C的新手,我正在研究一些简单的程序。我得到了

以下警告,我无法找到什么请问

让我知道导致此警告的原因。如果我忽略

这个警告怎么办?


inttoascii.c:38:警告:控制到达非空函数的结尾

Hi all,
I am new to C and I am working on some simple programs.I am getting
the following warning which I am not able to find what it is, please
let me know what is causing this warning.Also What happens if I ignore
this warning?

inttoascii.c:38: warning: control reaches end of non-void function

推荐答案

prashna< va ****** @ rediffmail。 COM>潦草地写道:
prashna <va******@rediffmail.com> scribbled the following:
大家好,
我是C的新手,我正在研究一些简单的程序。我得到了以下警告我无法找到它是什么,请
让我知道是什么导致了这个警告。如果我忽略了这个警告怎么办?
inttoascii.c:38:警告:控制到达非空函数的结尾
Hi all,
I am new to C and I am working on some simple programs.I am getting
the following warning which I am not able to find what it is, please
let me know what is causing this warning.Also What happens if I ignore
this warning? inttoascii.c:38: warning: control reaches end of non-void function




这意味着你已经定义了一个返回void
(这意味着它会返回任何可以赋值的类型),

并且你已经留下了一条路径让它完全执行而不会遇到

a" return"声明。这意味着,如果函数占用该路径,则返回值将无用。


-

/ - - Joona Palaste(pa*****@cc.helsinki.fi)--------------------------- \

| 飞翔的柠檬树中的金鸡王G ++ FR FW + M-#108 D + ADA N +++ |

| http://www.helsinki.fi/~palaste W ++ B OP + |

\ -----------------------------------------芬兰的规则! ------------ /

他说:''我不是猫王''。除了猫王之外还有谁能这么说?

- ALF



It means that you have defined a function returning other than void
(which means that it returns any type that you can assign values to),
and you''ve left a path for it to execute fully without ever encountering
a "return" statement. This means, if the function ever takes that path,
the returned value will be useless.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"He said: ''I''m not Elvis''. Who else but Elvis could have said that?"
- ALF




" prashna" < VA ****** @ rediffmail.com> schrieb im Newsbeitrag

新闻:d4 ************************** @ posting.google.c om ...

"prashna" <va******@rediffmail.com> schrieb im Newsbeitrag
news:d4**************************@posting.google.c om...
大家好,
我是C的新手,我正在研究一些简单的程序。我得到了以下警告,我无法找到它是什么,请
让我知道导致此警告的原因。如果我忽略了这个警告,会发生什么?


Redmont将被核攻击摧毁,也许:)

inttoascii.c:38:警告:控制到达无效功能的结束
Hi all,
I am new to C and I am working on some simple programs.I am getting
the following warning which I am not able to find what it is, please
let me know what is causing this warning.Also What happens if I ignore
this warning?
Redmont will be destroyed by a nuclear attack, perhaps :)

inttoascii.c:38: warning: control reaches end of non-void function




原因可能类似

int foo(int bar)

^^^^

{

/ *做一些酒吧* /

/ *然后你忘了退货,比如* /

返回0;

^^^^^^^^^^

}


罗伯特



The cause maybe something like
int foo(int bar)
^^^^
{
/*do something with bar*/
/*and then you forgot to return something, like*/
return 0;
^^^^^^^^^^
}

Robert


prashna写道:
prashna wrote:

大家好,
我是C的新手,我正在研究一些简单的程序。我得到了
以下警告,我无法找到它是什么,请
让我知道是什么原因引起了这个警告。


您应该发布您认为可能导致我的代码

在复制并尝试编译时会收到类似的警告。


我猜你有一个函数定义

应该在它前面有关键字void,但不是。

如果我忽略了这个警告会发生什么?

inttoascii.c:38:警告:控制到达非空函数的结尾

Hi all,
I am new to C and I am working on some simple programs.I am getting
the following warning which I am not able to find what it is, please
let me know what is causing this warning.
You should post code which you believe may cause me to
get a similar warning when I copy it and try to compile it.

I''m guessing that you have a function definition which
should have the keyword "void", in front of it, but doesn''t.
Also What happens if I ignore
this warning?

inttoascii.c:38: warning: control reaches end of non-void function




我建议你注意编译器警告,直到

你已经编程了大约十年,

然后重新考虑这个问题。


-

pete



I would advise you to pay attention to compiler warnings until
you have been programming for about ten years,
and then to reconsider the matter.

--
pete


这篇关于这个警告意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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