What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 130 Stack Exchange communities.

I'm the kind of person who is irked by poor spelling and grammar, so when I see a post with these sorts of errors I usually try to fix it. I recently stumbled upon a question with typos not only in the description of the problem, but in the comments in the code provided.

Obviously, changing code in any functional manner shouldn't be done except in specific circumstances, but what about changing comments to make them more legible?

I chose to leave them for now, (partially to make sure my edit got approved, so the other typos would be banished from the question), but I wanted to know if that was the right call.

share|improve this question
2  
There is a danger in editing code, including comments: You may accidentally obscure the problem. If you are just editing to satisfy an itch without adding real value to the question, my vote is that you leave it alone. –  George Cummins Jul 31 '13 at 17:19
3  
@GeorgeCummins Out of curiosity, how would fixing spelling/grammar in a comment obscure the problem? –  StephenTG Jul 31 '13 at 17:25
    
See the top two answers here. Their conclusions: "unless it's just a case of highlighting code as code, so that it displays nicely, you shouldn't change the code." and "Improving the grammar and spelling of the actual question is one thing, but changing code is a minefield." –  George Cummins Jul 31 '13 at 17:35
2  
@George however I disagree that a comment embedded in code is strictly code. Since if you remove it entirely, the code will still work. I don't see any harm in fixing spelling and grammar there, as long as there aren't any potential issues like the one djechlin pointed out (e.g. you should test that the code still compiles and runs as intended, and if it doesn't, maybe that is better criteria for leaving it alone). –  Aaron Bertrand Jul 31 '13 at 17:41

2 Answers 2

up vote 7 down vote accepted

The important thing is just to do it right. There is, after all, this behavior:

 // Will the next line be executed??/
 a++;

And if you remove the ?/ the behavior will, in fact, be changed.

A similar problem, that someone feels is the most stupid C bug ever:

else if (code == 200) {     // Downloading whole file
    /* Write new file (plus allow reading once we finish) */
    // FIXME Win32 native version fails here because Microsoft's version of tmpfile() creates the file in C:\
    g = fname ? fopen(fname, "w+") : tmpfile();
}

These are quite rare, but, even when editing comments in code, please be conscientious of things like this escaping issue.

share|improve this answer
    
Ah, that's definitely a good thing to be aware of. Here's a link to the post in question: stackoverflow.com/questions/17976681/… –  StephenTG Jul 31 '13 at 17:40
    
Regarding the "most stupid C bug ever", why is there a line continuation character () for a single-line comment? Curious design. –  Old Checkmark Jul 31 '13 at 17:45
    
@OldCheckmark the line continuation character is general it not just for single line comments. It is also processed before comments are removed from the document. –  FDinoff Jul 31 '13 at 18:06

If you're fixing spelling and grammar in the rest of the post, I would fix these as well. Do as much as you can to make the post attractive and easy to read while editing.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .