Issues with counter in a loop

GGKarman's icon

dear list,

I am having a problem with counter inserted in a loop which I don't quite understand. It is illustrated with the follwing patch :

Max Patch
Copy patch and select New From Clipboard in Max.

I would expect it to read three lines of text and then stop, but instead it is crashing max.

What I don't understand either is that when debugging the sequence of events, the last outlet of counter keeps reporting a carry count, and counter resets its count to 0 after the first iteration.

Thanks and Regards

Luke Hall's icon

Try resetting using the third inlet on [counter] as demonstrated in the patch below.

Max Patch
Copy patch and select New From Clipboard in Max.

lh

brendan mccloskey's icon

OT

there were two posters, whose solutions i regularly lurked: AlexHarker and tim lloyd, now there's three (+Luke Hall)

Brendan (Lurkio)

GGKarman's icon

Hi

in this regard I think the behaviour of the different inlets is confusing. I would have expected that A and B (see patch) would be equivalent (A works, and B produces a stack overflow)

Max Patch
Copy patch and select New From Clipboard in Max.

regards
nyh

seejayjames's icon

That is really weird. Looks like A and B should work the same. Not sure what I'm missing.

BTW, a HUGE thanks to C74 for starting to intercept stack overflows like this, it's such an improvement to how it worked in the past... crash!

Chris Muir's icon
Max Patch
Copy patch and select New From Clipboard in Max.

A well placed deferlow fixes this. I would have expected that a defer would have also fixed it, though, and am vaguely curious why it took a deferlow. Not enough to look into that, mind you, but still vaguely curious.

seejayjames's icon

I think the slight delay when accessing a [text] may be the issue, I've ran into vaguely similar situations in the past. It might not have time to fully output its line before it gets another line command, or... something.

Chris Muir's icon

I thought it might be "something," :-)