-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I see dead code #18004
Comments
On 7/29/20 7:51 PM, Todd Rinaldo wrote:
During a code review, I discovered quite a bit of code with significant
|#if 0| code in it. Unless we have a good reason we should remove them.
When time allows, I would like to remove this code and see what breaks,
possibly for merge.
I'm a little worried people have patches built around this where they do
|s/#if 0/#if 1/|
Could you provide some examples?
Thank you very much.
Jim Keenan
|
here are a few samples from
|
On Wed, Jul 29, 2020 at 04:51:22PM -0700, Todd Rinaldo wrote:
During a code review, I discovered quite a bit of code with significant
`#if 0` code in it. Unless we have a good reason we should remove them.
In my experience this is usually done as a bandaid: "this block of code is
wrong but I don't know how / don't have the time to fix it".
I wouldn't like these blocks to be removed without the underlying issues
being addressed.
…--
Little fly, thy summer's play my thoughtless hand
has terminated with extreme prejudice.
(with apologies to William Blake)
|
This c277df4#diff-dc8c62daf844c4b19510dfce777053a52ac4821852ef9818e3de8912dd3c4edbR519-R533 was added to the codebase in 1997, complete with the #if 0, so it was never commented out but added to the codebase as it was. This is a printf debugging which was left in the code during the commit. The other four cases of #if 0 were added by @khwilliamson, and they have comments on them.
and one from about 14 months ago, again by khwilliamson, which is clearly commented.
some of the #if 0 are just wrapping old printf debugging and could easily be removed. Four such statements were added in this commit: Most of them were removed but there is one left still in the code. Another one, from this commit: by Nick Ing-Simmons from 2001, is commented with "Test code - delete when it works ..." Another one dates from this commit: again by Nick Ing-Simmons, from 2000. It has a comment about FIXME but I doubt that will be useful now. |
Yeah. Taking a good look over them is probably a good idea, probably some can be removed and many undoubtedly could use an explanation, but blanket removal is unlikely to be helpful. |
The single #if 0 in sv.c was added here: Out of all the os2/OS2/OS2-Process/Process.xs cases, the youngest one is fifteen years old, and the oldest is 23 years old: https://github.com/Perl/perl5/blame/blead/os2/OS2/OS2-Process/Process.xs They are marked with comments like "does not work". All of them were added in commits by Ilya Zakharevich. Of the five in Configure, https://github.com/Perl/perl5/blame/blead/Configure one was commented out two years ago, and the others all date from a single commit 21 years ago by jhi: |
During a code review, I discovered quite a bit of code with
#if 0
code in it. Unless we have a good reason we should remove them.When time allows, I would like to remove this code and see what breaks, possibly for merge.
I'm a little worried people have patches built around this where they do
s/#if 0/#if 1/
The text was updated successfully, but these errors were encountered: