Re:Show HN: My weekend project - Codestagram
by Groxx on Friday January 04, 2013 @12:01AM
(#5006345)
Is that part of the spec for coercions, or is it exploiting a typical compiler's behavior? It certainly doesn't appear to be a required way to process that statement (optimizations could remove the 'if' portion entirely), unless it is actually required of the compiler.
if var is a float...
...becomes... ...which equals 0.5 and is considered true when evaluated. But if var is an int... ...becomes... ...which equals 0 and is considered false when evaluated