switch within switch

Bug reports (if you don't/won't have a Github account)
Post Reply
alank2
Member
Posts: 116
Joined: Wed Mar 01, 2017 7:24 pm

switch within switch

Post by alank2 »

>i4004.c:427:21: error: Too many cases

Is there a way to make a switch work within a switch?
stefano
Well known member
Posts: 2251
Joined: Mon Jul 16, 2007 7:39 pm

Re: switch within switch

Post by stefano »

Sub functions?
Have you tried with an extra parenthesis enclosure?
Could you show a code snippet?
User avatar
dom
Well known member
Posts: 2214
Joined: Sun Jul 15, 2007 10:01 pm

Re: switch within switch

Post by dom »

Sorry, I was far too tired last night so I didn't reply.

There's a limit of 256 case statements that can be pending - I'm not sure how you did it with an i4004 instruction set, but that's likely the problem. I can raise the limit, but in the mean time you can work around it by putting the second level switch statements into a separate function.
alank2
Member
Posts: 116
Joined: Wed Mar 01, 2017 7:24 pm

Re: switch within switch

Post by alank2 »

I've got 256 cases alright. The secondary switches within the first one aren't so big (maybe 6-7 cases), so maybe pushing 256 up to 512 would cover things well if that isn't detrimental. I only need 256 in the "parent" switch.
User avatar
dom
Well known member
Posts: 2214
Joined: Sun Jul 15, 2007 10:01 pm

Re: switch within switch

Post by dom »

The nightly from today has a limit of 512 - hopefully that'll be enough!
alank2
Member
Posts: 116
Joined: Wed Mar 01, 2017 7:24 pm

Re: switch within switch

Post by alank2 »

Is the nightly server down?
alank2
Member
Posts: 116
Joined: Wed Mar 01, 2017 7:24 pm

Re: switch within switch

Post by alank2 »

Downloaded the latest nightly; it compiles great now. Thanks dom and stefano!
Post Reply