I was just wondering wether there are any reasons why I shouldn't do something like this:
instead ofCode:void func(int p) { switch(p) { case 1: { int i; /* Do something with i */ } break; case 2: { char msg[10]; /* Do something with msg */ } break; } }
So basicly, is it alright to place brackets in every case and then declare variables in it? Because I'm learning the win32 API at the moment and I don't like it when I have to declare all of my variables at the top of the WndProc function, especially with big programs it's annoying...Code:void func(int p) { int i; char msg[10]; switch(p) { case 1: /* Do something with i */ break; case 2: /* Do something with msg */ break; } }



LinkBack URL
About LinkBacks


