Where is the huge difference, which generates error C2360, in following two definitions?
switch (msg) {
case WM_PAINT:
HDC hdc;
hdc = BeginPaint(hWnd, &ps); // No error
break;
}
and
switch (msg) {
case WM_PAINT:
HDC hdc = BeginPaint(hWnd, &ps); // Error
break;
}
The first is legal and the second isn't. Skipping a declaration without an initializer is sometimes allowed, but never one with an initializer.
See Storage allocation of local variables inside a block in c++.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments