[PD] What exactly is a "stack overflow" ?
Andy Farnell
padawan12 at obiwannabe.co.uk
Thu Dec 20 01:15:36 CET 2007
By that reckoning bang-until would run itself out after a few seconds.
One of us is wrong. (I apologise in advance :)
What's going on?
Perhaps we can reach a reasonable compromise in source.
If you knew that an accidentally banged until would give up
after a couple of minutes it wouldn't be so bad.
On Wed, 19 Dec 2007 17:49:44 -0600
Russell Bryant <russell at russellbryant.net> wrote:
> 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
>
> _______________________________________________
> PD-list at iem.at mailing list
> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
--
Use the source
More information about the Pd-list
mailing list