Hacker News new | past | comments | ask | show | jobs | submit login

> All but the stupidest compiler (which usually means no optimisation at all, not even precomputing constants) will not be affected by completely extraneous variables.

The statement is certainly false in this general form, even with full link-time optimizations. If the type has a constructor with side effects external to the program (e.g. it makes syscalls), the compiler cannot remove the variable.




If they cause visible side-effects, they are by definition not extraneous.


I'm not interested in playing this semantics game. The compiler can't know whether a syscall has side effects. And some side effects can be benign and irrelevant, and you definitely left the variable in by mistake, but they're still side effects.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: