-1 is often used to signify infinity, so the code using it would
probably be a little clearer if it used that.  However, since 0 isn't
a logical value anyway, that's probably a good idea, though I haven't
seen much bare type-converting in the Parrot source.

On 3/30/07, Nicholas Clark <[EMAIL PROTECTED]> wrote:
On Fri, Mar 30, 2007 at 10:25:59PM +0000, Alek Storm wrote:
> How about like this:
>
> $P0 = getinterp
> $P0["recursionlimit"] = 2000
> $P0["recursionlimit"] = -1
>
> Where the last one signifies an infinite recursion limit (unsafe, but
> it should still be available to HLL implementors).

Is the value "recursionlimit" signed or unsigned?

Using 0 to flag the infinite recursion limit might feel more natural.

Using -1 to mean ~0 makes me edgy. In particular, because in C you can end
up with integer size promotion meaning that -1 isn't -1. Or at least what
you thought was -1 isn't -1 any more, because it was converted to unsigned,
and then converted to a larger unsigned type, and so is now an unremarkable
positive integer, rather than all bits set.

Nicholas Clark

Reply via email to