My notes are primarily intended for future readers of the question, not the author. I try to find other ways to clean up questions because I know it's not great, but sometimes it seems less bad than the alternatives. (E.g. removing large swaths of stuff the original poster wrote because it's totally misleading and will send other beginners down the wrong track as they read this question and try to figure out if their problem is the same as this.)
The note you quoted was one of 3 I edited into that question. The first 2 were substantially more useful; I wouldn't have edited to add that last one if I wasn't already leaving my fingerprints on the question with the first two. In hindsight I agree that one about bad tutorials could and maybe should have been a comment instead. Only the OP had fallen into the trap of believing everything they read on the Internet (including the official docs and a random wrong tutorial), not necessarily future readers; simply marking as a duplicate should make it clear to everyone else that the tutorial was wrong. OTOH, there's some reason to reassure future readers that it's truly a duplicate.
I'm not claiming my judgement on edits is perfect, just best-effort attempts to improve questions (and answers). Since any post can always be improved later by others, or by me after helpful feedback like this, perfection isn't necessary. I'm pretty sure when I submitted that edit, I knew it wasn't great to be leaving this many notes, but I didn't have any better ideas and didn't want to take forever figuring out what to do. (I already have dozens of tabs of half-finished answers that I've been meaning to get back to, but sometimes "good enough" is ok, especially for a totally confused question based on one person's specific version of common misconceptions / misunderstandings that I expected to have low but many non-zero future value.)
Re: (editor's note) in general: Stack Overflow aims to be a collection of useful Q&As for the benefit of future readers.
Let me try to explain why I leave such notes in general. The one you quoted is not a representative example of them, it's a case where I mostly failed.
As @MichaelPetch described, my goal here was narrowing the question to just the one the OP explicitly asked about, to make it clear that it was just a duplicate. Assembly language especially has too many pitfalls for every question about one thing (but that happens to have other bugs) to justify a custom answer instead of a duplicate + optionally addressing the other problems that weren't being asked about.
If a question about one thing has other unrelated bugs in its example, or raises other unfounded concerns (especially about an often-misunderstood subject like GNU C inline asm), future readers will be likely be misled if they don't go digging through the comments if that's the only place such things are addressed. SO posts are supposed to be useful without the comments, in the long term.
(Or do we want to decide that comments are not ephemeral 2nd-class citizens, and are sufficient for leaving corrections to unrelated mistakes in duplicate questions that are supposed to be "useful signposts"? Because that seems worse)
GNU C inline asm is hard, and wrong examples should be exterminated
(Or at least commented on, within the same code
block, to make sure anyone seeing them doesn't pick up a misconception about the subject.)
Experience has shown that GNU C inline asm is one of the most frequently misunderstood things in C / assembly. It's very easy for an asm()
statement to happen to work given one set of surrounding code. If you understand asm
statements, it's often easy to construct a case that reveals the bug, but without that knowledge it could go undetected for a long time until some surrounding code and/or new compiler version happen to trip over it in someone's real use-case. (Some people even fail to comprehend this fact, and will vehemently argue their code is correct because it works. Anyone who understands the concept of undefined behaviour will know that's wrong, and that constraints that don't correctly describe the asm template are a special case of UB.)
In cases where I would normally just leave a comment about unrelated bugs, I edit when it's related to GNU C inline asm, even if it's just to add a // comment
about something being unsafe. (And typically I'd go into more detail in a comment under the post, unless I'm editing an answer then sometimes the explanation can go into the answer if the bug was present in the question.)
Avoiding wrong code in fragments that might actually get copy/pasted is a good policy in general, but for inline asm I go even further. Every inline asm statement with wrong constraints is a dangerous example, even in questions (where there's less expectation that code should be correct).
(There are good examples in https://stackoverflow.com/tags/inline-assembly/info)
For things other than inline asm, I'd normally just look for more duplicates for the other unmentioned bugs, and leave comments about them.
memory
clobber. That in itself is fixing a problem the OP doesn't know about (and thus the editors note about it). I personally would not have made such an edit to the question and would disagree with Peter making such a material change to the original code. That should have been left to the comments.[assembly]
questions or answers, so are just making a mess in tags they don't contribute to. It needs to get closed again, if you'd care to do the honours.