发信人: warehouse() 
整理人: girlrong(1999-11-09 10:16:42), 站内信件
 | 
 
 
 -- ※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.98.35.154] 发信人: vcc (vcc), 信区: C 标  题: Re: UNREFERENCED_PARAMETER是干什么的? 发信站: 网易虚拟社区 (Tue Jul  6 12:52:09 1999), 站内信件
  【 在 warehouse (石头) 的大作中提到: 】
 用来消除编译警告,未引用的参数的警告。
 看看这个宏的定义就知道了,
 相当于:
 void test(int /* i */) { // 参数 i 在函数中没有被引用
 ...
 }
 等价于
 void test(int i) {
 UNREFERENCED_PARAMETER(i);// 参数 i 在函数中没有被引用
 ....
 }
 //
 // Macros used to eliminate compiler warning generated when formal
 // parameters or local variables are not declared.
 //
 // Use DBG_UNREFERENCED_PARAMETER() when a parameter is not yet
 // referenced but will be once the module is completely developed.
 //
 // Use DBG_UNREFERENCED_LOCAL_VARIABLE() when a local variable is not  yet
 // referenced but will be once the module is completely developed.
 //
 // Use UNREFERENCED_PARAMETER() if a parameter will never be reference d.
 //
 // DBG_UNREFERENCED_PARAMETER and DBG_UNREFERENCED_LOCAL_VARIABLE will 
 // eventually be made into a null macro to help determine whether ther e
 // is unfinished work.
 //
 
 #if ! (defined(lint) || defined(_lint))
 #define UNREFERENCED_PARAMETER(P)          (P)
 #define DBG_UNREFERENCED_PARAMETER(P)      (P)
 #define DBG_UNREFERENCED_LOCAL_VARIABLE(V) (V)
 
 #else // lint or _lint
 
 // Note: lint -e530 says don't complain about uninitialized variables  for
 // this.  line +e530 turns that checking back on.  Error 527 has to do  with
 // unreachable code.
 
 #define UNREFERENCED_PARAMETER(P)          \
     /*lint -e527 -e530 */ \
     { \
         (P) = (P); \
     } \
     /*lint +e527 +e530 */
 #define DBG_UNREFERENCED_PARAMETER(P)      \
     /*lint -e527 -e530 */ \
     { \
         (P) = (P); \
     } \
     /*lint +e527 +e530 */
 #define DBG_UNREFERENCED_LOCAL_VARIABLE(V) \
     /*lint -e527 -e530 */ \
     { \
         (V) = (V); \
     } \
     /*lint +e527 +e530 */
 
 #endif // lint or _lint
 
  -- ※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.103.146.7]
  | 
 
 
 |