The off-topic list at meta includes:
- Questions containing broken code or asking for advice about code not yet written are off-topic, as the code is not ready for review.
So questions must compile and work, in order to be considered on-topic questions. Consider: Count every word occurrence from file. This code obviously will not compile as presented. It is missing four
<fstream>). Based on the phrasing of OP's question, the code does work and the concern is simply algorithmic. So I simply editted in the includes.
This was removed due to:
Code in a question must never be edited. Your edit is more appropriate as a comment.
Obvious, but still an educated guess. We don't know the order of the includes, nor do we know if the code compiles despite missing includes. Therefore, putting the missing includes in there seamlessly is not appropriate; a comment would be better.
I find that reasoning ludicrous. The order of the includes is definitely irrelevant to the question (at best, there could be irrelevant
#includes that merit a comment about their irrelevance), and the code will not compile without them (try it). I am not changing variable names, code structure, or anything vital to the question. I am simply making the question adhere to the guidelines.
Otherwise, the only valid response is a vote-to-close - which seems excessive since outside of the missing
#includes, the question is perfectly reasonable. As the question currently has 4 upvotes and zero close votes (despite, again, containing broken code), it seems that the community implicitly agrees with this.
I simply want to make it explicit. Should this sort of edit be deemed acceptable? What if OP (a new user) does not return to edit in the missing includes? Should the question be closed then?