私はこの関数を書きました:
static bool colorIsEmpty(const Color col)
{
return (col[0] == 0 && col[1] == 0 && col[2] == 0 );
}
ここで、Colorは単にfloat[3]です。col [3]がすべて0の場合、関数は機能しません。しかし、これは機能します:
if(col[0] == col[1] == col[2] == 0) {
//gets called
}
ただし、gccは私に警告を出します:
cColorTest.c:212:5: warning: suggest parentheses around
comparison in operand of ‘==’ [-Wparentheses]
それで、その関数が機能するなら、それは素晴らしいでしょう、なぜそれは機能しないのですか?つまり、関数は常にfalseを返します。