![]() SetWindowSubclass ( p_ctrl->ctrl, WndCtrls::CtrlProc, 0, (DWORD_PTR)p_ctrl ) ) // C-style cast ![]() ![]() (HINSTANCE)GetWindowLongPtr ( hwnd, GWL_HINSTANCE ), // Problematic C-style cast for which I already know workaround I am trying to pass pointer p_ctrl to WinAPI callback function, for which I want to use DWORD_PTR parameter of callback function (below example is working, but contains C-style casts where commented): WndCtrls* WndCtrls::Button ( WndCtrls* const p_ctrl, HWND hwnd, RECT const &rc ) ![]() Replacing C-style casts with C++-style casts helps guard against unexpected errors According to Herb Sutter's C++ Coding Standards: 101 Rules, Guidelines, and Best Practices programmer should avoid c-style casting:Ĭ-style casts have different (and often dangerous) semantics depending on context, all disguised behind a single syntax. ![]()
0 Comments
Leave a Reply. |