S
Shao Miller
Hey CLC,
I was wondering if there is a way to avoid the C short circuiting for
boolean expressions such as the following:
if(a && b && c) {
/* Do stuff */
}
I am currently doing GPU programming and it would be better to evaluate
the entire condition, even if a is 0, since branches are slow.
#include <stdio.h>
#define f(x) ((x) ? 1 : 0)
int main(void) {
int a, b, c = b = a = 0;
if (1 << 2 >> f(a) >> f(b) >> f(c))
puts("Boo.");
else
puts("Yay.");
return 0;
}