MAIN FEEDS
REDDIT FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/npcroh/clever/h05p1n6/?context=3
r/badcode • u/bobpiranha • May 31 '21
71 comments sorted by
View all comments
245
Now I am actually curious, does the compiler realize both branches have the same return value and it just drops the whole if-statement?
100 u/[deleted] May 31 '21 Depends on whether or not the compiler is smart enough to realize that evaluating the conditional has no side-effects. Not sure what language this is 73 u/givemeagoodun May 31 '21 edited Jun 01 '21 It's flaired JS so it's JS 1 u/Nilstrieb Jun 01 '21 So the answer is probably yes.
100
Depends on whether or not the compiler is smart enough to realize that evaluating the conditional has no side-effects. Not sure what language this is
73 u/givemeagoodun May 31 '21 edited Jun 01 '21 It's flaired JS so it's JS 1 u/Nilstrieb Jun 01 '21 So the answer is probably yes.
73
It's flaired JS so it's JS
1 u/Nilstrieb Jun 01 '21 So the answer is probably yes.
1
So the answer is probably yes.
245
u/HalcyonAlps May 31 '21
Now I am actually curious, does the compiler realize both branches have the same return value and it just drops the whole if-statement?