how to use static function in header and compare with float array
Posted
by
ed k
on Stack Overflow
See other posts from Stack Overflow
or by ed k
Published on 2012-11-09T10:49:37Z
Indexed on
2012/11/09
11:00 UTC
Read the original article
Hit count: 180
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?
© Stack Overflow or respective owner