空虚 [英] void

查看:86
本文介绍了空虚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



跟随和平代码的(void)poService是什么意思


tclCtrlBoard :: tclCtrlBoard(void * poService)

{


#如果定义了某种东西

(void)poService; \\这是什么意思


}

解决方案

hyderabadblues写道:


跟随代码和平代码(void)poService是什么意思


tclCtrlBoard :: tclCtrlBoard(void * poService)

{


#如果定义了某种东西

(void)poService;这是什么意思


}



没什么,浪费打字,删除它。


John


hyderabadblues写道:


是什么( void)poService in followinf peace of code mean


tclCtrlBoard :: tclCtrlBoard(void * poService)

{


#如果定义了什么

(void)poService; \\这是什么意思


}



这是编译器警告参数poService的一种解决方法是没有使用
。它告诉编译器计算表达式poService和

来忽略它。人们为应付忙碌的人做什么并不好......


-


- - Pete

Roundhouse Consulting,Ltd。( www.versatilecoding.com

标准C ++库扩展:教程和
参考的作者。 ( www.petebecker.com/tr1book


2007年2月17日星期六08:03:01 -0500,Pete Becker< pe ** @ versatilecoding.com>

写道:


> hyderabadblues写道:


>以下代码和平代码中的(void)poService是什么意思
tclCtrlBoard :: tclCtrlBoard(void * poService)
{

#if defined something Something
(void)poService;这是什么意思

}


这是一个编译器警告声明poService未被使用的解决方法。它告诉编译器评估表达式poService和
忽略它。人们如何应对忙碌的编辑器,这不是很好吗?



这个繁忙的编译器功能可能会被添加为警告,帮助你找到错误的
。如果OP想要消除警告,请将函数'

定义更改为:


tclCtrlBoard :: tclCtrlBoard(void *)

{

}

有时某些输入参数仅在调试版本期间。在那种情况下

我倾向于使用:


#if定义(DEBUG)

#define DEBUG_VAR(x)(x )

#else

#define DEBUG_VAR(x)

#endif


tclCtrlBoard :: tclCtrlBoard(void * DEBUG_VAR(poService))

{

#if defined DEBUG

//使用poService进行调试

VERIFY(poService == 0);

#endif

}


-dr



What does (void) poService in followinf peace of code mean

tclCtrlBoard::tclCtrlBoard( void* poService )
{

# if defined Something
(void) poService; \\ What does this mean

}

解决方案

hyderabadblues wrote:

What does (void) poService in followinf peace of code mean

tclCtrlBoard::tclCtrlBoard( void* poService )
{

# if defined Something
(void) poService; \\ What does this mean

}

Nothing, it''s a waste of typing, remove it.

John


hyderabadblues wrote:

What does (void) poService in followinf peace of code mean

tclCtrlBoard::tclCtrlBoard( void* poService )
{

# if defined Something
(void) poService; \\ What does this mean

}

It''s a workaround for a compiler warning that the argument poService is
not used. It tells the compiler to evaluate the expression poService and
to ignore it. Isn''t it wonderful what people do to cope with busybody
compilers?

--

-- Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com)
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." (www.petebecker.com/tr1book)


On Sat, 17 Feb 2007 08:03:01 -0500, Pete Becker <pe**@versatilecoding.com>
wrote:

>hyderabadblues wrote:

>What does (void) poService in followinf peace of code mean

tclCtrlBoard::tclCtrlBoard( void* poService )
{

# if defined Something
(void) poService; \\ What does this mean

}


It''s a workaround for a compiler warning that the argument poService is
not used. It tells the compiler to evaluate the expression poService and
to ignore it. Isn''t it wonderful what people do to cope with busybody
compilers?

That busybody compiler feature was probably added as a warning that helps you
find bugs. If the OP wants to get rid of the warning, change the function''s
definition to:

tclCtrlBoard::tclCtrlBoard(void*)
{
}
Sometimes certain input parameters are only during debug builds. In that case
I tend to use:

#if defined(DEBUG)
#define DEBUG_VAR(x) (x)
#else
#define DEBUG_VAR(x)
#endif

tclCtrlBoard::tclCtrlBoard(void* DEBUG_VAR(poService))
{
#if defined DEBUG
// Use poService for debugging
VERIFY(poService == 0);
#endif
}

-dr


这篇关于空虚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆