This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Stupid off-topic question
> Cc: gcc@gcc.gnu.org
> From: nbecker@fred.net
> Date: 03 Aug 2000 08:02:52 -0400
>
> Just to clarify, I understand how the result was obtained. The
> problem is, I don't think this is reasonable behaviour.
>
> In particular, the unwary user (me) writes something like:
>
> i % j
>
> where j happens to be size_t, an unsigned. The result is very
> unexpected to the poor user. Sure, it obeys the cited rule, but is
> this really the way you want your modulus operator to behave?
Well, you could try to propose your rule to the C standards
committee. However, they've just done a major revision to the
standard, and the next one isn't due until 2009.
The behaviour on division might seem annoying, but this is certainly
what you want for +, -, and probably for multiplication.
--
- Geoffrey Keating <geoffk@cygnus.com>