A certain tutorial for the Win32 API uses this line to transform the lParam
argument from a WM_CREATE
message in the main window procedure into a CREATESTRUCT*
:
reinterpret_cast<CREATESTRUCT*>(lParam) // Method 1
I've read elsewhere that reinterpret_cast
is dangerous and results in undefined behavior, lightning bolts, and whatnot.
I've used a more conventional cast which the compiler doesn't complain about:
(CREATESTRUCT*) lParam // Method 2
Is there a reason the author of the tutorial did it their way?
And, I'm sure there's a better way than mine?