未知的编译器警告 [英] Unknown Compiler Warning

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

问题描述

大家好,


我很想知道是否有人可以告诉我这个警告,因为我已经写了一个相当大的应用程序
我正在接受很多很多

这些警告。我不知道他们的意思以及如何摆脱它们


C:\Program Files \ Microsoft Visual Studio .NET

2003 \\ _Vc7 \include \ xlocale(609):警告C4100:''_ Lobj'':未参考

正式参数


任何帮助都将非常感谢,


Adam

Hi All,

I was wonder if somebody could tell me about this warning, as I have
written a fairly large application and I am gettting lots and lots of
these warning. I have no real clue what they mean and how to get rid of them

C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\xlocale(609) : warning C4100: ''_Lobj'' : unreferenced
formal parameter

Any help would be much appreciated,

Adam

推荐答案

Adam Hartshorne写道:
Adam Hartshorne wrote:
我很奇怪如果有人可以告诉我这个警告,因为我已经写了一个相当大的应用程序,我正在收到很多很多这些警告。我不知道他们的意思是什么以及如何摆脱它们

C:\Program Files \ Microsoft Visual Studio .NET
2003 \ Vc7 \ include \xlocale(609):警告C4100:''_ Lobj'':未参考
形式参数

任何帮助将不胜感激,
I was wonder if somebody could tell me about this warning, as I have
written a fairly large application and I am gettting lots and lots of
these warning. I have no real clue what they mean and how to get rid of
them

C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\xlocale(609) : warning C4100: ''_Lobj'' : unreferenced
formal parameter

Any help would be much appreciated,



这是我最后一次这样做:把光标放在''C4100''的东西上

在Build中窗口并按F1。享受您提供给您的在线帮助

。或者,转到帮助按钮。并搜索''C4100''。


通常的未使用的正式参数来自编译一个函数,

声明一个参数_with_一个名字,从不使用它:


int foo(double d){

返回42; //'''''这里没有使用

}


V

-

请在邮寄回复时从我的地址中删除资金



This is the last time I will do this: put your cursor on the ''C4100'' thing
in the "Build" window and press F1. Enjoy the online help provided to you
by your product. Alternatively, go to "Help" and search for ''C4100''.

The usual "Unused formal argument" comes from compiling a function that
declares an argument _with_ a name and never uses it:

int foo(double d) {
return 42; // ''d'' is not used here
}

V
--
Please remove capital As from my address when replying by mail


Adam Hartshorne写道:
Adam Hartshorne wrote:
大家好,

我很想知道是否有人可以告诉我这个警告,因为我已经写了一个相当大的应用程序而且我正在接受很多很多这些警告。我没有真正的线索他们的意思和如何摆脱它们

C:\ Program Files \ Microsoft Visual Studio .NET
2003 \Vc7 \ include \xlocale(609):警告C4100:''_ Lobj'':未参考
形式参数

任何帮助将不胜感激,
Hi All,

I was wonder if somebody could tell me about this warning, as I have
written a fairly large application and I am gettting lots and lots of
these warning. I have no real clue what they mean and how to get rid
of them

C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\xlocale(609) : warning C4100: ''_Lobj'' : unreferenced
formal parameter

Any help would be much appreciated,



这很难说,因为你(我猜)假设我们可以通过精神上的方式看看你的代码。但是,当没有引用

形式参数时,这通常是一个警告。


如果这没有帮助,请阅读常见问题解答关于如何发布一个正确的问题。


Brian



It''s difficult to say, because you (I guess) assume that we can
psychically look at your code. However, that''s usually a warning when a
formal parameter isn''t referenced.

If that doesn''t help, read the FAQ about how to post a proper question.

Brian


Adam Hartshorne写道:
Adam Hartshorne wrote:
大家好,

我很想知道是否有人可以告诉我这个警告,因为我已经写了一个相当大的应用程序而且我正在收到很多很多这些警告。我不知道他们的意思是什么以及如何摆脱它们

C:\Program Files \ Microsoft Visual Studio .NET
2003 \ Vc7 \ include \xlocale(609):警告C4100:''_ Lobj'':未参考
形式参数
Hi All,

I was wonder if somebody could tell me about this warning, as I have
written a fairly large application and I am gettting lots and lots of
these warning. I have no real clue what they mean and how to get rid of
them

C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\xlocale(609) : warning C4100: ''_Lobj'' : unreferenced
formal parameter




关闭警告。


它是为这样的代码生成的:


int f(int i)

{

返回1;

}


该代码没有任何问题。有时你需要额外的参数

以便与其他函数保持一致,即使这些参数在某些情况下不是



通常会使这个警告无声的一个技巧是使用

中的参数一些简单的方法:


int f(int i)

{

i = i;

返回1;

}


现在参数用来。当然,你可能会收到一个警告,即

代码没有任何效果,然后你必须写一些东西来安静地发出

警告。如果你愿意,你可以玩这个游戏几个小​​时。或者你可以从愚蠢的警告中转出
并继续实际工作。


如果你不是,大多数C ++编译器都不会发出警告给

参数一个名字,但如果你的代码还必须以b编译为
这个技巧就行不通,因为C需要一个名字。


-


Pete Becker

Roundhouse Consulting,Ltd。



Turn off the warning.

It gets generated for code like this:

int f(int i)
{
return 1;
}

There''s nothing wrong with that code. Sometimes you need extra arguments
for consistency with other functions, even if those arguments aren''t
used in some cases.

A trick that usually silences this warning is to use the argument in
some trivial way:

int f(int i)
{
i = i;
return 1;
}

Now the argument is used. Of course, you might get a warning that the
code has no effect, and you then have to write something to quiet that
warning. You can play this game for hours if you like. Or you can turn
off stupid warnings and get on with real work.

Most C++ compilers won''t give this warning if you don''t give the
argument a name, but that trick won''t work if your code also has to
compile as C, because C requires a name there.

--

Pete Becker
Roundhouse Consulting, Ltd.


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

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