[PD] What exactly is a "stack overflow" ?
Russell Bryant
russell at russellbryant.net
Thu Dec 20 00:49:44 CET 2007
Frank Barknecht wrote:
> If people want to make sure to not be bitten by the endless loop, they
> could just use
>
> [inlet]
> |
> [b]
> |
> [f 1000000000000]
> | [inlet]
> | |
> [until]
> |
> [outlet]
>
> as an abstraction called: [funtil] It will bang 1000000000000 times
> unless stopped, which is more bangs for the bang than most people
> would want.
It doesn't look like that would work. The number of times to run is stored as
an int, which on most systems is 4-bytes. The maximum is a bit over 2 billion
for a float input. :)
Also, from looking at the implementation of [until], a simple bang until will
stop after a complete overflow over the storage space in an integer, which is
usually 4 billion and change.
(x_count is an int.)
static void until_bang(t_until *x)
{
x->x_run = 1;
x->x_count = -1;
while (x->x_run && x->x_count)
x->x_count--, outlet_bang(x->x_obj.ob_outlet);
}
--
Russell Bryant
More information about the Pd-list
mailing list