I was looking on some examples and I don't know what this means:
if(FileExistsA("File.ext"), false)
{
....
}
Can someone explain me this please?
I was looking on some examples and I don't know what this means:
if(FileExistsA("File.ext"), false)
{
....
}
Can someone explain me this please?
In C and C++ (but not C# or Java), the comma operator ',
' evaluates both the left and right expressions, but only returns the right expression.
In this example:
bool x = (true, false);
// x == false
bool y = (false, false, true)
// y == true
In your case, if( FileExistsA("File.ext"), false )
will never follow its branch because the comma operator ensures that false
is the result.
Update I forgot about the precedence of =
and ,
. I've wrapped the expressions above in parenthesis to prevent the expression from being evaluated as (bool x = true), false === false
.