| Topic: |
DEVELOP > c-Plus-Plus |
| User: |
"Adam Hartshorne" |
| Date: |
09 Mar 2006 01:32:07 PM |
| Object: |
Unknown Compiler Warning |
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
.
|
|
| User: "Alf P. Steinbach" |
|
| Title: Re: Unknown Compiler Warning |
09 Mar 2006 02:06:06 PM |
|
|
* Adam Hartshorne:
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,
Since the warning is generated for code in the standard library, I think
the best advice is what Pete Becker wrote, to turn off that warning.
Such warnings are known as 'silly-warnings', and the compiler you're
using spews out so indecently many of them that the same firm has a
habit of listing all the #pragma's that turn them off, in some central
place in their code.
For your own code, simply don't name an unreferenced formal argument.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
.
|
|
|
|
| User: "Default User" |
|
| Title: Re: Unknown Compiler Warning |
09 Mar 2006 01:51:03 PM |
|
|
Adam Hartshorne wrote:
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,
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
.
|
|
|
|
| User: "Pete Becker" |
|
| Title: Re: Unknown Compiler Warning |
09 Mar 2006 01:58:38 PM |
|
|
Adam Hartshorne wrote:
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
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.
.
|
|
|
| User: "Martin Vejnar" |
|
| Title: Re: Unknown Compiler Warning |
09 Mar 2006 08:27:01 PM |
|
|
Pete Becker wrote:
Adam Hartshorne wrote:
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
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;
}
I think the warning will disappear if you do
int f(int /*i*/)
{
return 1;
}
.
|
|
|
| User: "Adam Hartshorne" |
|
| Title: Re: Unknown Compiler Warning |
09 Mar 2006 08:29:28 PM |
|
|
Martin Vejnar wrote:
Pete Becker wrote:
Adam Hartshorne wrote:
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
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;
}
I think the warning will disappear if you do
int f(int /*i*/)
{
return 1;
}
AS I have mentioned before I can't / don't want to do this as the
warning is coming from xlocale, a header file which is built in to
visual studio and one which i have not altered or directly referenced!!!!
Adam
.
|
|
|
| User: "Martin Vejnar" |
|
| Title: Re: Unknown Compiler Warning |
10 Mar 2006 02:43:05 AM |
|
|
Adam Hartshorne wrote:
Martin Vejnar wrote:
Pete Becker wrote:
Adam Hartshorne wrote:
[snip]
C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\xlocale(609) : warning C4100: '_Lobj' :
unreferenced formal parameter
[snip]
I think the warning will disappear if you do
int f(int /*i*/)
{
return 1;
}
AS I have mentioned before I can't / don't want to do this as the
warning is coming from xlocale, a header file which is built in to
visual studio and one which i have not altered or directly referenced!!!!
When it comes to VS2003 I cannot say for sure, but on VS2005 the
<xlocale> header is referenced through multiple levels of indirection
from, for example, <iostream>. I'd say that the same thing is happening
to you.
Why are you worried about fixing a buggy (inconvenient) header file?
There is '/wd' option for compiler that can be used to disable specific
warnings.
.
|
|
|
|
|
|
| User: "Adam Hartshorne" |
|
| Title: Re: Unknown Compiler Warning |
09 Mar 2006 02:03:38 PM |
|
|
Pete Becker wrote:
Adam Hartshorne wrote:
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
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.
Ok I understand what you are saying. However I haven't intensionally
used xlocale, i don't even know what it does.
Adam
.
|
|
|
| User: "Pete Becker" |
|
| Title: Re: Unknown Compiler Warning |
09 Mar 2006 02:09:48 PM |
|
|
Adam Hartshorne wrote:
Ok I understand what you are saying. However I haven't intensionally
used xlocale, i don't even know what it does.
I know. I was ranting about stupid warnings. This is one you should just
turn off.
--
Pete Becker
Roundhouse Consulting, Ltd.
.
|
|
|
| User: "Adam Hartshorne" |
|
| Title: Re: Unknown Compiler Warning |
09 Mar 2006 02:16:00 PM |
|
|
Pete Becker wrote:
Adam Hartshorne wrote:
Ok I understand what you are saying. However I haven't intensionally
used xlocale, i don't even know what it does.
I know. I was ranting about stupid warnings. This is one you should just
turn off.
How do I turn it off?
Adam
.
|
|
|
| User: "Pete Becker" |
|
| Title: Re: Unknown Compiler Warning |
09 Mar 2006 02:44:06 PM |
|
|
Adam Hartshorne wrote:
How do I turn it off?
I think it's
#pragma warning(disable: 4100)
but you should look it up.
--
Pete Becker
Roundhouse Consulting, Ltd.
.
|
|
|
|
|
|
|
| User: "Adam Hartshorne" |
|
| Title: Re: Unknown Compiler Warning |
09 Mar 2006 02:04:18 PM |
|
|
Pete Becker wrote:
Adam Hartshorne wrote:
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
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.
Thanks for the answer, I had kind of guess that, but I don't
intensionally use xlocale, I don't even know what it does.
Adam
.
|
|
|
|
|
| User: "Victor Bazarov" |
|
| Title: Re: Unknown Compiler Warning |
09 Mar 2006 01:44:23 PM |
|
|
Adam Hartshorne wrote:
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,
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
.
|
|
|
|

|
Related Articles |
|
|