3 ms·
One of my primary languages is C89 and don't find it an impediment. It's been over 2 decades since I last touched Pascal so I'm not sure how it works there, but
by userbinator 3y ago
One of my primary languages is C89 and don't find it an impediment. It's been over 2 decades since I last touched Pascal so I'm not sure how it works there, but in C you can always open a new inner scope with { and declare more variables there.
and at times even in performance (you only declare variables you actually use).
All but the stupidest compiler (which usually means no optimisation at all, not even precomputing constants) will not be affected by completely extraneous variables.
- mike_hock 3y ago> 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.
- userbinator 3y agoIf they cause visible side-effects, they are by definition not extraneous.
- mike_hock 3y agoI'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.