how to use static function in header and compare with float array
- by ed k
I wrote this function:
static bool colorIsEmpty(const Color col)
{
return (col[0] == 0 && col[1] == 0 && col[2] == 0 );
}
where Color is simply a float[3];
the function doesn't work if col[3] are all 0;
but this works:
if(col[0] == col[1] == col[2] == 0) {
//gets called
}
however gcc gives me warning:
cColorTest.c:212:5: warning: suggest parentheses around
comparison in operand of ‘==’ [-Wparentheses]
so it would be nice if that function works,why it doesn't work?