[mingw - C/C++] warning: comparison is always true due to lim

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[mingw - C/C++] warning: comparison is always true due to lim


Read and respond to this message at:
By: neo_in_matrix

I have the following code:

typedef unsigned char byte;
bool IsUTF8DeadChar(byte b)
        return b == 0xc0 || b == 0xc1 || (b >= 0x0f5 && b <= 0x0ff);

When I compile it with MinGW 3.4.2, it gives me a warning:

warning: comparison is always true due to limited range of data type

But I tested with several values, it seems my function works correctly - at
least it does not *always* return true.

So I am wondering if this warning superfluous or erroneous at all?

You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit:

SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at: