Compilers are not uniform in their interpretation of nested comments.
Compilers are not uniform in their interpretation of nested comments.
For the love of god, please, they are meant for checking each others code for mistakes and not for miniscule details like this. I have seen it time and time again in various companies where code review is used as some sort of tool to dictate style and preferences to each other. Wasting valuable development time and creating a unhealthy tension between developers.
Code reviews are invaluable in education other developers about your code, how to support it and how to develop on it. But information should also flow the other way and the give the reviewers the opportunity to present the accepted practices to the developer. In the long term, this saves developer time as the code base stays coherent. Code is read many times and needs to be understood by many developers even though it is written only once.
We use various automated techniques to pick up mistakes and use code review to ensure style is consistent.
Everyone in the company should be able to parse any piece of code without individual styles disrupting that.
The only tension occurs around the weighty question of line length - coding standard says 76 chars max, I say that's what the IDE's for.
However, some things don't break well, so readability ought to trump.
If you are not compiling on multiple platforms, then complaining about stuff like this because of compiler issues is a nuisance. (You could still object on the basis that it is fugly.)
At best, this gimmick is for hacking out some temp code while debugging, and should not be submitted.
Of course, one should just use an IDE, or even vim, to commenting out code as needed.
/*/ Version one, currently commented
/*/ Version two, currently active /**/
And a single star switches from version two to version one.But I agree this shouldn't be left in production code; it's just a handy trick for switching between two blocks of code†. An #ifdef is also good, but that's C/C++ only.
† Whoever suggested that some editors can comment a block of code missed the point utterly - which is to switch between code blocks easily.
And every language has the IF construct.
And of you are flipping between two implementation so frequently, your actual problem is that you have no idea how your program works.