Re: Style question: comparison between signed and unsigned?

Linus Torvalds (torvalds@transmeta.com)
Mon, 22 Sep 1997 17:51:04 -0700 (PDT)


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?

Be my guest. But as long as we're talking about a C compiler I do believe
we should take such small silly considerations as what the language is all
about into account. Humour me.

Just about _everything_ in C uses the "negative means error" approach.
It's not only "read()", it's "printf()" and friends, etc etc. The only
library routines that don't do this is (a) routines that cannot have
errors (sure, the trivial ones) and (b) routines that return a pointer
(they return NULL instead that doesn't have this problem).

And I definitely consider at the very _minimum_ the standard C library to
be part of the language.

And people are seriously considering adding warnings to the compiler that
makes it harder to write correct code that tests for errors using these
standard features? I really don't see the logic behind that. Warnings are
supposed to _help_ you write good code, not be in the way of doing so.

Linus