in this example, although I will never use the WNDCLASSEX, x, y, cx, cy variables, they will still use memory when I'm in a message loop:
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpArgs, int iCmdShow) { WNDCLASSEX wc; ... RegisterClassEx(&wc); const int cx = 640; const int cy = 480;
But I wonder if I put them in scope, will they use memory during the message loop? eg.
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpArgs, int iCmdShow) { { WNDCLASSEX wc; ... RegisterClassEx(&wc); const int cx = 640; const int cy = 480;
or maybe if I put them in two functions and named them in winmain, for example.
wnd_register(hInst); wnd_create(hInst);
won't let them use memory?
c ++ variables scope
Kaije
source share