473,396 Members | 1,799 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,396 software developers and data experts.

"Comparison to integral constant is useless; the constant is outside the range of type 'int'"

"Comparison to integral constant is useless; the constant is outside the
range of type 'int'"
How can I fix this compiler warning, please, for the following pseudocode?

int m_nError;
m_nError = somedriverapi.DoSomething();
if (m_nError != 0x8010002F) foobar; << compiler warning here

thankyou
Claire
Sep 3 '07 #1
1 6564
Hello, Claire!

Warning is generated, because value 0x8010002F exceeds the valid range of
int type.
Due to sign information max value of int is 2^31

You can use uint instead of int. uint max value is 2^32. Or use cast to
uint.
if ((uint)m_nError != 0x8010002F) foobar;

--
With best regards, Vadym Stetsiak.
Blog: http://vadmyst.blogspot.com
You wrote on Mon, 3 Sep 2007 10:52:42 +0100:

C"Comparison to integral constant is useless; the constant is outside
Cthe range of type 'int'"
CHow can I fix this compiler warning, please, for the following
Cpseudocode?

Cint m_nError;
Cm_nError = somedriverapi.DoSomething();
Cif (m_nError != 0x8010002F) foobar; << compiler warning here

Cthankyou
CClaire
Sep 3 '07 #2

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

Similar topics

3
by: mettle | last post by:
I'm trying to define a bunch of consant global variables in C, but I'm getting a "initializer element is not constant" error I think because I'm trying to define one in terms of the other. The...
56
by: Adem | last post by:
C/C++ language proposal: Change the 'case expression' from "integral constant-expression" to "integral expression" The C++ Standard (ISO/IEC 14882, Second edition, 2003-10-15) says under...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.