Shop OBEX P1 Docs P2 Docs Learn Events
Limits on nesting ? — Parallax Forums

Limits on nesting ?

CassLanCassLan Posts: 586
edited 2009-12-25 22:28 in Propeller 1
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

Prop Forum Search (Via Google)

·

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-12-24 14:37
    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.
  • CassLanCassLan Posts: 586
    edited 2009-12-24 14:43
    Thanks Mike,
    I'm only talking about 4 or 5 deep.

    I'm sure its me smile.gif






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


    NYC Area Prop Club

    Prop Forum Search (Via Google)

    ·
  • SamMishalSamMishal Posts: 468
    edited 2009-12-25 15:04
    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
    ·
  • BradCBradC Posts: 2,601
    edited 2009-12-25 21:25
    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.
  • RaymanRayman Posts: 14,876
    edited 2009-12-25 22:24
    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
  • BradCBradC Posts: 2,601
    edited 2009-12-25 22:28
    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.
Sign In or Register to comment.