PDA

View Full Version : Limits on nesting ?



CassLan
12-24-2009, 10:34 PM
I was just wondering...is there a limit on the number of nested repeat and case commands?

I'm getting some wierd behavior...

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


NYC Area Prop Club (http://www.gothampropclub.com)

Prop Forum Search (Via Google) (http://search.parallax.com/search?site=parallax&client=parallax&output=xml_no_dtd&proxystylesheet=parallax&proxycustom=<HOME/>&ie=&oe=&lr=)

·

Mike Green
12-24-2009, 10:37 PM
There is some kind of limit, but it's pretty large. I think it's 32 or 64 or something similar. That degree of nesting is poor programming practice though. You should really break that up into methods. It's hard to keep track of where you are in the program with that degree of nesting.

You'll get an explicit error message, not weird behavior. If you're getting weird behavior, you've probably made an error and you've got the nesting messed up.

CassLan
12-24-2009, 10:43 PM
Thanks Mike,
I'm only talking about 4 or 5 deep.

I'm sure its me http://forums.parallax.com/images/smilies/smile.gif






▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


NYC Area Prop Club (http://www.gothampropclub.com)

Prop Forum Search (Via Google) (http://search.parallax.com/search?site=parallax&client=parallax&output=xml_no_dtd&proxystylesheet=parallax&proxycustom=<HOME/>&ie=&oe=&lr=)

·

SamMishal
12-25-2009, 11:04 PM
CassLan said...
Thanks Mike,
I'm only talking about 4 or 5 deep.

If you are calling methods during the repeats and you are in a cog then maybe it is a STACK problem

check out the reserved stack.....

Samuel
·

BradC
12-26-2009, 05:25 AM
The limit is 8 nested blocks and the compiler will complain loudly if you try and exceed it.

Here are the error messages in the Parallax Compiler




Limit of 64 cases exceeded
Limit of 8 nested blocks exceeded
Limit of 32 unique objects exceeded
Limit of 32 unique DAT files exceeded
Limit of 1024 DAT symbols exceeded
Limit of 16 ELSEIFs exceeded
Limit of 4096 local variables exceeded
Limit of 15 parameters exceeded
Limit of 256 subroutines + objects exceeded


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Life may be "too short", but it's the longest thing we ever do.

Rayman
12-26-2009, 06:24 AM
Yes, I found out about that limit the hard way too...
Think there's a real reason for this limit?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm

BradC
12-26-2009, 06:28 AM
Rayman said...
Yes, I found out about that limit the hard way too...
Think there's a real reason for this limit?


At a guess I'd suggest the compiler uses static allocation.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Life may be "too short", but it's the longest thing we ever do.