(expression 1) ? expression 2 : expression 3
If expression 1 evaluates to true, then expression 2 is evaluated.
If expression 1 evaluates to false, then expression 3 is evaluated instead.
(expression 1) ? expression 2 : expression 3
If expression 1 evaluates to true, then expression 2 is evaluated.
If expression 1 evaluates to false, then expression 3 is evaluated instead.
msFrameSpan /= upsampleFPS ? 2 : 1;
if (upsampleFPS) msFrameSpan /= 2;
would achieve the same, omitting an unnecessary division by 1. Not sure if every compiler is able to optimize that code to leave out that operation.
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
19 Experts available now in Live!