This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SCOPE STACK OVERFLOW

HI, i am writing a program in which there are many do-while loops one inside the other...
when i try compile this program... it gives me a error stating.."'{' scope stack overflow.."
it point to braces i have used in DO-WHILE an IF statement...
plss help me to solve this problem...
THANKS...

Parents
  • So then there really was a good reason for me to ask you exactly why you thought you needed so very indented code.

    for(;;) {
        key = check_keys();
        switch (state) {
            ...
            case STATE_MAINMENU:
                if (key == ENTER) {
                    state = menuchoices[curr_menu_item];
                }
                break;
                ...
            case STATE_WAITINPUT:
                if (key == ESC) {
                    state = STATE_MAINMENU:
                } else {
                    ...
                }
                break;
            ...
        }
    }
    

    You want your main loop to iterate often, so it can check important global states. That means that the main loop should try to avoid to contain subroutines (or nested loops) that will take any significant amount of time.

Reply
  • So then there really was a good reason for me to ask you exactly why you thought you needed so very indented code.

    for(;;) {
        key = check_keys();
        switch (state) {
            ...
            case STATE_MAINMENU:
                if (key == ENTER) {
                    state = menuchoices[curr_menu_item];
                }
                break;
                ...
            case STATE_WAITINPUT:
                if (key == ESC) {
                    state = STATE_MAINMENU:
                } else {
                    ...
                }
                break;
            ...
        }
    }
    

    You want your main loop to iterate often, so it can check important global states. That means that the main loop should try to avoid to contain subroutines (or nested loops) that will take any significant amount of time.

Children