2012-02-27 61 views
0

我有以下的内联函数:C++的语法解释

inline void normalizeGrayOutputCentredSigmoide(const type meanValue=(type)0.0, const type sensitivity=(type)2.0, const type maxOutputValue=(type)255.0) 
{ 
    normalizeGrayOutputCentredSigmoide(meanValue, sensitivity, 255.0, this->Buffer(), this->Buffer(), this->getNBpixels()), maxOutputValue; 
}; 

在这条线出现以下编译器警告:

warning: right-hand operand of comma has no effect 

任何人能描述一下这种书面应该做的功能?

逗号运算符在这种情况下意味着什么?

+1

您在最后一个参数之前关闭您的方法 – 2012-02-27 09:28:42

回答

2

maxOutputValue是你的函数的参数之外。编译器因此将其视为comma operator的正确操作数,在这种情况下,该操作数无效。详情请参阅链接的维基百科页面。

1

maxOutputValue之前关闭了括号,所以编译器将其解释为功能之后它是“无用”的价值,这是错误的说法