Re:You've just inherited a legacy C++ codebase, now what?
by SAI_Peregrinus on Thursday February 29, 2024 @02:14PM
(#39553708)
Better to use `#if` or `#ifdef` to prevent compilation. C & C++ don't support nested comments, so you can end up with existing comments in the code ending the comment block.
Re:You've just inherited a legacy C++ codebase, now what?
by kccqzy on Thursday February 29, 2024 @04:02PM
(#39555034)
I think `#if` and `#ifdef` are not good ideas because they prevent the compiler from seeing them in the first place. A better solution is just `if (false)` which is nestable, and the code is still checked by the compiler so it won't bit rot.
If going the route, I'd recommend commenting out the lines rather than removing them outright to simplify the diffs at least until you're ready to squash and merge the branch.