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
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to