Thoughts on switchs.

Started by
9 comments, last by Khatharr 11 years, 3 months ago
My winprocs often end up with each line looking something like:

case LABEL: labelProc(); break;

If you are going to do that, you may as well just have a container of pointers to function, or a container of std::function, or a container of signals (like boost::signal). You just "register" in that container any behavior you need to have in response to events, and then the function itself is very clean. I have done this type of thing before around select() for network programming in Unix, and it works great.

That sounds like a good idea. I'll look in to it.

void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

This topic is closed to new replies.

Advertisement