RAD Studio |  |

W8075: Suspicious pointer conversion (C++)

(Command-line option to suppress warning: -w-sus)

The compiler encountered some conversion of a pointer that caused the pointer to point to a different type.

You should use a cast to suppress this warning if the conversion is proper.

A common cause of this warning is when the C compiler converts a function pointer of one type to another (the C++ compiler generates an error when asked to do that). It can be suppressed by doing a typecast. Here is a common occurrence of it for Windows programmers:

Copy Code

    #define STRICT
    #include <windows.h>
    LPARAM _export WndProc( HWND , UINT , WPARAM , LPARAM );
    test() {
       WNDCLASS wc;
       wc.lpfnWndProc = WndProc;  //warning
    }

It is suppressed by making the assignment to lpfnWndProc as follows:

Copy Code

    wc.lpfnWndProc = ( WNDPROC ) WndProc;

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!