c++ - Cast DWORD_PTR to class and vice versa without c-style cast -
according herb sutter's c++ coding standards: 101 rules, guidelines, , best practices programmer should avoid c-style casting: c-style casts have different (and dangerous) semantics depending on context, disguised behind single syntax. replacing c-style casts c++-style casts helps guard against unexpected errors i trying pass pointer p_ctrl winapi callback function, want use dword_ptr parameter of callback function (below example working, contains c-style casts commented): wndctrls* wndctrls::button ( wndctrls* const p_ctrl, hwnd hwnd, rect const &rc ) { p_ctrl->ctrl = createwindowex ( 0, l"button", p_ctrl->w_classnamebutton.c_str (), ws_visible | ws_child | bs_ownerdraw, rc.left, rc.top, rc.right, rc.bottom, hwnd, 0, (hinstance)getwindowlongptr ( hwnd, gwl_hinstance ), // problematic c-style cast know workaround p_ctrl ); setwindowsubclass...