Re: Style question: comparison between signed and unsigned?

Peter Moulder (
Fri, 26 Sep 1997 15:28:45 +1000 (EST)

It's sometimes appealing to use `int31's and the like, as a message to
programmer (and potentially compiler, if the compiler were changed to
recognise this) that the thing can never hold either negative or very big
(i.e. high bit set) values, so can safely be cast to either u32 or s32.

If a compiler with this extension had size_t as an int31 then `-5 <
(size_t) 3' would be true, as would `0xfffffffb > (size_t) 3', and in
neither case would a warning be issued (except with -Wansi -Wpedantic and
other compatibility warnings).