Fr4nz

Error when using "==" operator on uint4 variable

Discussion created by Fr4nz on Mar 4, 2010
Latest reply on Mar 6, 2010 by gaurav.garg

Let's suppose we have this code:

 

uint4 var;

instructions....

if(var == 0)

.....



compiler gives me this error:

 

error: expression must have arithmetic or pointer type
              if(var == 0)


Nothing changes if I do an explicit cast, (uint4), over 0 or I use (0,0,0,0) instead of 0.

I think this is not correct, because section 6.3.e of OpenCL specs says that the "==" operator should work also on vector types and if the operand types doesn't match, an implicit conversion will be done on one of the operands.

Same problem applies for "!=" operator.

 

 

Outcomes