zoukankan      html  css  js  c++  java
  • VC 中关于UNREFERENCED_PARAMETER的使用

    使用vc10 时建C++的工程时,自动生成的入口函数如下:

    int APIENTRY _tWinMain(HINSTANCE hInstance,
                         HINSTANCE hPrevInstance,
                         LPTSTR    lpCmdLine,
                         int       nCmdShow)
    {
        UNREFERENCED_PARAMETER(hPrevInstance);
        UNREFERENCED_PARAMETER(lpCmdLine);
    
         // TODO: Place code here.
        MSG msg;
        HACCEL hAccelTable;
    
        // Initialize global strings
        LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
        LoadString(hInstance, IDC_S_WAR3HELPER, szWindowClass, MAX_LOADSTRING);
        MyRegisterClass(hInstance);
    
        // Perform application initialization:
        if (!InitInstance (hInstance, nCmdShow))
        {
            return FALSE;
        }
    
        hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_S_WAR3HELPER));
    
        // Main message loop:
        while (GetMessage(&msg, NULL, 0, 0))
        {
            if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
            {
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            }
        }
    
        return (int) msg.wParam;
    }

    前中的前两行有 UNREFERENCED_PARAMETER

    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    这个宏在 winnt.h 中定义如下:

    #define UNREFERENCED_PARAMETER(P) (P)

    该宏的作用是展开传递的参数或表达式,其目的是避免编译器关于未引用参数的警告。

  • 相关阅读:
    JQuery之动画效果
    JS (随着鼠标的移动,旁边显示放大图)
    jQuery 事件和动画
    jQuery 概述
    CSS (层叠样式表)
    css的文章部分的基本语句
    HTML基本语法
    Web
    JavaScript预解析案例,JavaScript预解析题目
    JavaScript预解析 变量提升与函数提升
  • 原文地址:https://www.cnblogs.com/aqing1987/p/4337536.html
Copyright © 2011-2022 走看看