[Freeciv-Dev] Re: [FreeCiv-Cvs] nb: Change the type of the parameter siz
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
freeciv-dev@xxxxxxxxxxx |
Subject: |
[Freeciv-Dev] Re: [FreeCiv-Cvs] nb: Change the type of the parameter size in my_rand... |
From: |
David Pfitzner <dwp@xxxxxxxxxxxxxx> |
Date: |
Thu, 29 Jul 1999 11:04:52 +1000 (EST) |
> From: freeciv@xxxxxxxxxxxxxxxxxxx
> This is an automated notification of a change to freeciv cvs,
> on Wed Jul 28 15:47:17 PDT 1999 = Wed Jul 28 22:47:17 1999 (GMT)
> by Nicolas Brunel <brunel@xxxxxxxxxxxxxxxxxxxx>
> Change the type of the parameter size in my_rand from int to
> RANDOM_TYPE. It was done to be sure to use % on a greater or equal to
> zero number.
I agree with the problem, but I'm not sure this is the best fix.
It means if myrand() is called with a negative value, that value
will be implicitly cast to unsigned and then used in myrand.
But if myrand is really called with a negative value, thats
a bug which should be fixed elsewhere. So it may be better
to just put in the assert() you mentioned.
That is, in principle having the parameter be unsigned would
be fine, but I don't think we ever actually need values which
don't fit in a normal int, and leaving it signed may help catch
errors.
Regards,
-- David
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] Re: [FreeCiv-Cvs] nb: Change the type of the parameter size in my_rand...,
David Pfitzner <=
|
|