Thursday, April 24, 2014

Let's write some dummy code

Portion of some amazing WinAPI kind of hack defines in headers:

#define UNREFERENCED_PARAMETER(P) {(P)=(P);}
#define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);}

It wouldn't be anything weird unless I found something here:
LRESULT APIENTRY EditBoxProc(
    HWND hwndDlg, 
    UINT uMsg, 
    WPARAM wParam, 
    LPARAM lParam) 
{ 
    HWND hwndEdit; 
 
    switch(uMsg) 
    { 
        // Typical switch case stuff (..)
    } 
    return FALSE; 
        UNREFERENCED_PARAMETER(lParam); 
} 
Although it does nothing, it does more nothing, because the statement is after end of function.. (Apparently it suppresses some warnings.)
Am I missing something or the only compiler which buys it can be made by Microsoft? I suppose this could be sufficient here (at least for GCC):
LRESULT APIENTRY EditBoxProc(
    HWND hwndDlg, 
    UINT uMsg, 
    WPARAM wParam, 
    LPARAM) { .. }

No comments:

Post a Comment