3 ms·
I've come around to the idea that you should never comment out code, you should use #if #endif. And if the code has been replaced then you should include the ne
by Gibbon1 7y ago
I've come around to the idea that you should never comment out code, you should use #if #endif. And if the code has been replaced then you should include the new and old code as follows.
// comment that explains what the change was and why we are keeping the old code around.
// Date we made this change.
#if true
new code
#else
old code
#endif
- ktpsns 7y agoThat's a good idea, but it requires the language ecosystem to be shipped with that kind of preprocessor. In the given examples (Java and Python), that's not the case. And the proposal fails if you comment out non-compiling code without the context switch to a preprocessor: if false: this(does not compile) else: that.might("be")