Re: warning: comparison between signed and unsigned integer expressions

Christiaan Hofman <[email protected]>
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
Try to use the correct type if possible so you don't get the warnings. And when that's really not possible, type one of the variables.

Christiaan

On Apr 19, 2010, at 23:21, SD wrote:

> How do people normally handle the comparison between signed and unsigned integers?  I have cross platform code (Mac and Windows and 32 bit and 64 bit compilations). 
> How do people normally get rid of the compiler warning for this code:
> 
> 
> off_t fileLength = ...;
> size_t bytesRead = ...;
> 
> if(bytesRead != fileLength)  //this line gives
>  //warning: comparison between signed and unsigned integer expressions
> {
> }
> 
> Currently I just ignore it, but it's annoying and sloppy.
> 
> Thanx again all.
> SD
> 
> -- 
> ==========================================
> SD
> 
> WARNING: Programming may be habit forming.
> _______________________________________________
> MacOSX-dev mailing list
> [email protected]
> http://www.omnigroup.com/mailman/listinfo/macosx-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.