C++语法解释

C++ syntax explanation

本文关键字:解释 语法 C++      更新时间:2023-10-16

我有以下内联函数:

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

有人能描述这种书面函数应该做什么吗?

逗号运算符在这种情况下是什么意思?

maxOutputValue在函数参数之外。因此,编译器将其处理为逗号运算符的右操作数,在这种情况下,这是无效的。有关详细信息,请参阅链接的维基百科页面。

您在maxOutputValue之前关闭了括号,因此编译器将其解释为一个函数,并在其之后解释为"无用"值,这就是错误所说的