Masatoshi Kimura
unread,Feb 17, 2014, 5:35:32 PM2/17/14You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to dev-pl...@lists.mozilla.org
Hello,
I recently changed a way to declare function pointers to be loaded
lazily on Windows.
Traditionally, we have to write a function prototype manually to declare
a function pointer. Example:
typedef int (WINAPI *tMessageBoxW)(HWND, LPCWSTR, LPCWSTR, UINT);
tMessageBoxW messageBoxW =
(tMessageBoxW) GetProcAddress(user32, "MessageBoxW");
This is boring and error prone.
However, the new C++ decltype can eliminate the hand-written prototypes:
decltype(MessageBoxW)* messageBoxW =
(decltype(MessageBoxW)*) GetProcAddress(user32, "MessageBoxW");
This keyword is available since MSVC 10. I decided to introduce it to
Mozilla tree because Mozilla doesn't build on MSVC 9 or earlier.
Please see bug 969918 for more details.
Reagrds,
Masatoshi Kimura