This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: constant signed/unsigned comparison warning
- To: egcs at cygnus dot com, gcc2 at cygnus dot com
- Subject: Re: constant signed/unsigned comparison warning
- From: Per Bothner <bothner at cygnus dot com>
- Date: Wed, 24 Sep 1997 13:05:47 -0700
> But that's not correct. If you're writing INT_MAX + 1 bytes, then the
> return value is INT_MIN, and that's an indication of success.
If you are writing INT_MAX + 1, then it is not going to fit in ssize_t
or int, and I doubt the code would work in any case. Perhaps if you
are really lucky and/or the people writing the kernel and libc have been
very careful, it might work.
Posix.1 says:
If the value of nbyte is greater than {SSIZE_MAX}, the result is
implementation defined.
Still, if people (such as kernel implementors) want that sort of code
to work, then it seems perfectly reasonable to add a cast to say
"yes, I have thought about this, and I know what I'm doing."
--Per Bothner
Cygnus Solutions bothner@cygnus.com http://www.cygnus.com/~bothner