Re: Style question: comparison between signed and unsigned?

Dean Gaudet (dgaudet-list-linux-kernel@arctic.org)
Mon, 22 Sep 1997 18:10:17 -0700 (PDT)


On Mon, 22 Sep 1997, Linus Torvalds wrote:

>
>
> On Mon, 22 Sep 1997, Dean Gaudet wrote:
> >
> > I know this is where the warning is generated. But my claim is that this
> > supposedly "bad" code is forced due to the lame prototype for read().
> > Overloaded return values are bad.
> >
> > You could misinterpret the compiler's warning to mean you need a cast ...
> > but really it means you need to redesign your code :)
>
> Redesign the whole C language? Or "just" all of the library?

"just" all of the library. It's really what's at fault. Microsoft (or
IBM) got it right when they did OS/2's system api ... and win32's api also
does it right. The return value is always an error code, other returns
are passed by reference. The only time you're hassled is when using the
legacy C library. Microsoft's compilers generate signed-unsigned warnings
as part of their "-Wall" equivalent.

Unfortunately it's a wee bit more of an overhaul than adding const and
switching from ints to size_ts in the first place was.

Dean