473,386 Members | 1,803 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to suppress warning in VC++

I posted this question earlier but on the wrong usenet.
I have a warning below that I need to suppress

*warning C4018: '<' : signed/unsigned mismatch

I searched google, Microsoft help and MSDN for an answer but no luck.
I don't want to fix the cause because it's how the program is supposed to
work. It's part of an example in a text and the example suppresses a similar
warning in Borland. I am sure there must be a way to do this in dotnet, but
how?
Nov 17 '05 #1
4 12771
J Swift wrote:
I posted this question earlier but on the wrong usenet.
I have a warning below that I need to suppress

*warning C4018: '<' : signed/unsigned mismatch

I searched google, Microsoft help and MSDN for an answer but no luck.
I don't want to fix the cause because it's how the program is
supposed to work. It's part of an example in a text and the example
suppresses a similar warning in Borland. I am sure there must be a
way to do this in dotnet, but how?


Cast one of the operands to the other type.

e.g.

int i;
unsigned j;
// ...

if (unsigned(i) < j)
{
// ...
}

-cd
Nov 17 '05 #2

"J Swift" <ju**@hotmail.CUT.com> wrote in message
news:42******@nntp.zianet.com...
I posted this question earlier but on the wrong usenet.
I have a warning below that I need to suppress

*warning C4018: '<' : signed/unsigned mismatch

I searched google, Microsoft help and MSDN for an answer but no luck.
I don't want to fix the cause because it's how the program is supposed to
work. It's part of an example in a text and the example suppresses a similar warning in Borland. I am sure there must be a way to do this in dotnet, but how?


pragma warning (disable: 4018)

/Fredrik

Nov 17 '05 #3
If you are using VS.NET you can also lower your compilers warning level this
may help. For example go to Project->Properties under C\C++ change the
warning level to one lower than what it is currently set at and continue to
drop it until the warning goes away, or just turn off warning altogether
(not recommended). You can also do this is you are using the command line
version of the compiler by issue the /W<warning level number> ie /W3 /W2 /W1
etc or /W0 for no warnings.

Hope that helps.

John
"J Swift" <ju**@hotmail.CUT.com> wrote in message
news:42******@nntp.zianet.com...
I posted this question earlier but on the wrong usenet.
I have a warning below that I need to suppress

*warning C4018: '<' : signed/unsigned mismatch

I searched google, Microsoft help and MSDN for an answer but no luck.
I don't want to fix the cause because it's how the program is supposed to
work. It's part of an example in a text and the example suppresses a
similar warning in Borland. I am sure there must be a way to do this in
dotnet, but how?

Nov 17 '05 #4

"John L. DeVito" <sp**@digitalkhaos.net> wrote in message
news:KvOVd.92700$bu.75881@fed1read06...
If you are using VS.NET you can also lower your compilers warning level
this may help. For example go to Project->Properties under C\C++ change
the warning level to one lower than what it is currently set at and
continue to drop it until the warning goes away, or just turn off warning
altogether (not recommended). You can also do this is you are using the
command line version of the compiler by issue the /W<warning level number>
ie /W3 /W2 /W1 etc or /W0 for no warnings.

Hope that helps.

John
"J Swift" <ju**@hotmail.CUT.com> wrote in message
news:42******@nntp.zianet.com...
I posted this question earlier but on the wrong usenet.
I have a warning below that I need to suppress

*warning C4018: '<' : signed/unsigned mismatch

I searched google, Microsoft help and MSDN for an answer but no luck.
I don't want to fix the cause because it's how the program is supposed to
work. It's part of an example in a text and the example suppresses a
similar warning in Borland. I am sure there must be a way to do this in
dotnet, but how?



Thanks to all who answered... I got through it and learned more by your
responses
Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Krishna Srinivasan | last post by:
I have a form with check boxes. When accessing a check box element that is not checked, I get a notice (Notice: Undefined variable..). Is there a way to hide these notices and warning in PHP code...
4
by: Bill Dee | last post by:
I use XML comments around most of my class libraries public property and methods, for example: /// <summary> /// blah blah /// </summary> However I have a few dozen public constants as well...
9
by: Doug Ly | last post by:
Hi, When I run this query using WinSQL to connect to a DB2 database, it gave me the warning: Error: SQLSTATE 01003: Null values were eliminated from the argument of a column function. ...
4
by: Susan Bricker | last post by:
Hi. I have a routine for the AfterUpdate event of a checkbox on my Main Menu. The checkbox causes a "User Variable" (in a table for UserSettings) to be modified ('Y' or 'N') by issuing an...
5
by: Robert A Riedel | last post by:
I have a class that is intended to be exported in a DLL that uses another class that is in a static library. All clients that use the DLL will also link with the same static library. In summary,...
6
by: Kim Hellan | last post by:
I want to suppress the following warning when compiling. warning CS0169: The private field 'myvar' is never used In C++ you would do something like (not sure of the syntax): #pragma nowarn:0169...
1
by: Chris Stankevitz | last post by:
My .vcproj references an environment variable that no longer exists: Creating library... Project : warning PRJ0018 : The following environment variables were not found: $(WXWIN) How do I...
3
by: Chris Shenton | last post by:
I am setting up handlers to log DEBUG and above to a rotating file and ERROR and above to console. But if any of my code calls a logger (e.g., logging.error("foo")) before I setup my handlers, the...
13
by: Rex Mottram | last post by:
I'm using an API which does a lot of callbacks. In classic callback style, each routine provides a void * pointer to carry user-defined data. Sometimes, however, the user-defined pointer is not...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.