'blocks nested too deeply' error

Monkey Forums/Monkey Programming/'blocks nested too deeply' error

lom(Posted 2015) [#1]
I've been using MinGW for compiling my projects and everything was fine. Today I tried to compile with Visual Studio 2010 and it gave me an error in main.cpp file:
 fatal error C1061: compiler limit : blocks nested too deeply


I've checked it and it turned out that the problem happens because I have 90 'Case' statements in one of my 'Select' blocks.

Does Visual Studio has a limitations in number of 'if' statements?


Nobuyuki(Posted 2015) [#2]
There is a block limit in VS2005 of 64 nested levels (or a switch/elseIf) and for later versions, 256. Consider changing your flow control to reduce the number of case statements. Building everything inside one "god" switch is definitely not OOP-friendly.