Hacker News new | ask | show | jobs
by AlphaSite 3354 days ago
Im fairly certain shaders can and do eliminate compile time if statements, you can observer this by seeing which uniforms are defined (for example in WebGL).
1 comments

You mean if we write

if (some_constant_expression) { //...code... }

and some_constant_expression evaluates to false, the entire code block will be stripped from the result?

That may be true, but it's not standardized behavior, is it?

True for many compilers for many years. Its a way to integrate 'conditional compilation' into the normal program flow. It can make the code easier (or harder) to read. Use judiciously.