Monday, May 31, 2010

lazy evaluation

C++ uses short circuit evaluation, if the whole conditions's result is known, the compiler do not waste to check the rest. Like
if(b<2 && (a=a+1)) printf("X\n"); never print, because a=a+1 never happen. So the compiler does not waste time to check the rest.

1 comment: