If (int a) problem

So here is part of a code i got:

1
2
3
4
5
DLLIMPORT void lv_ocl_Scalar_subtract(int sc, int ocl_src1, int dst, int mask, int *err)
{
try { 
	if (mask)
		subtract(*((Scalar*) sc) ,*((oclMat*) ocl_src1),*((oclMat*) dst),*((oclMat*) mask));


What trubbled me is whats with the if (mask). I mean, mask is an int so what does that if mean? The computer can read it as if (10), will he say yes or no
Last edited on
It'll evaluate the int as a bool.

So, if (mask) == if (mask != 0).
Makes sense, thanks.

If something is undefined, would it automatically be considered 0 when used? I know thats how it goes in other langueges.
Last edited on
No. If it's undefined, you will get a compiler error and will not get an executable file.
Topic archived. No new replies allowed.