-----Original Message----- From: Boost [mailto:boost-bounces@lists.boost.org] On Behalf Of Niall Douglas Sent: Friday, August 28, 2015 19:08 To: boost@lists.boost.org Subject: Re: [boost] [AFIO] Review (or lack of it) On 28 Aug 2015 at 8:29, Roland Bock wrote:
#if 0 is code smell.
These are entirely personal opinion based on suppositions and assumptions with zero technical relevance to the quality of a library, as was a lot of the stuff I snipped. I don't work in pristine code environments, I like to keep around bits of code in #if 0 blocks to remind me of things, or for the occasional use, or for any other reason. I personally would find such segments educational when reviewing a library rather than the unfounded claim of "code smell" which may be true in other code bases in your experience, but I can assure you is not the case in my code bases.
I can think of two good reasons for '#if 0' blocks in production code. The first is where you'd like to have a reminder of something that was tried and didn't work, so that others know why it wasn't done that way and maybe not to try it. The second is for code that will be enabled, once some other condition is satisfied. It's true that the second can be maintained using branches, but that's not always practical for small snippets. In both cases, there should be a clear comment that explains why the code is disabled. While AFIO has such comments (though often quite terse) in some cases, there are several where it seems the reader is left to guess why it has been left in the code, but disabled. In short, there should always be a clear purpose behind leaving an #if 0'd block in the code. As long as that's true, it shouldn't be hard to state that in a brief, clear comment. Matt ________________________________ This e-mail contains privileged and confidential information intended for the use of the addressees named above. If you are not the intended recipient of this e-mail, you are hereby notified that you must not disseminate, copy or take any action in respect of any information contained in it. If you have received this e-mail in error, please notify the sender immediately by e-mail and immediately destroy this e-mail and its attachments.