6 ms·
That's what the debugger is for (if you inherited it). However, a lot of desktop applications are written that way. If you've ever dealt with Win32, you'll see
by csmuk 13y ago
That's what the debugger is for (if you inherited it).
However, a lot of desktop applications are written that way. If you've ever dealt with Win32, you'll see nested switch statements from hell on your average project.
If you have a pure OO language like Java or C# then there's no excuse but some legacy applications built in C tend to be "switchy" because the older APIs seem to favour that form of message dispatch.
There is still no excuse as you can have decent abstraction in C or C++.
However for what is effectively a jump table, a switch statement is exactly spot on for this project.