如何在Delphi中禁用关于“返回值...可能未定义”的警告? [英] How to disable a warning in Delphi about "return value ... might be undefined"?

查看:335
本文介绍了如何在Delphi中禁用关于“返回值...可能未定义”的警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个函数给我以下警告:


[DCC警告] filename.pas(6939):W1035返回值函数'function'可能是未定义的


然而,这个函数是干净的,小的,并且有一个已知的,预期的,返回的值。函数中的第一个语句是:

  Result:=''; 

并且没有局部变量或参数称为 Result 也可以。



有没有任何类型的类似pragma的指令,我可以围绕这个方法来删除这个警告?这是Delphi 2007。



不幸的是,这个Delphi安装的帮助系统不起作用,所以我现在无法弹出这个警告的帮助。 p>

任何人都知道他们的头顶上可以做什么?

解决方案

你确定你已经做了一切来解决警告吗?也许你可以发布代码让我们看看?



你可以通过这种方式在本地关闭警告:

  {$ WARN NO_RETVAL OFF} 
函数func(...):string;
begin
...
end;
{$ WARN NO_RETVAL ON}


I have a function that gives me the following warning:

[DCC Warning] filename.pas(6939): W1035 Return value of function 'function' might be undefined

The function, however, is clean, small, and does have a known, expected, return value. The first statement in the function is:

Result := '';

and there is no local variable or parameter called Result either.

Is there any kind of pragma-like directive I can surround this method with to remove this warning? This is Delphi 2007.

Unfortunately, the help system on this Delphi installation is not working, therefore i can't pop up the help for that warning right now.

Anyone know off the top of their head what i can do?

解决方案

Are you sure you have done everything to solve the warning? Maybe you could post the code for us to look at?

You can turn off the warning locally this way:

{$WARN NO_RETVAL OFF}
function func(...): string;
begin
  ...
end;
{$WARN NO_RETVAL ON}

这篇关于如何在Delphi中禁用关于“返回值...可能未定义”的警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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