This question already has an answer here:
I noticed a couple things that have been pointed out repeatedly. Having an exemplar of that single issue (not a bunch of issues in a long piece of code) can be pointed back to along with a simple note. People elaborate on the issue to various degrees, but really there could be a comprehensive explanation with references to other resources and examples.
I’d like to run it by the group before posting one, and also ask that a tag be created for that purpose. People can search for
[exemplar] along with a language tag to find these (in particular, experienced answer writers can check the collection).
If there are naturally-occuring posts that have one clear issue, referring back to that is great. But they should still be tagged so I can discover them and know they exist.
Candidates for exemplars:
using namespace std;
OP: waaaah, why not?
OA: adds a paragraph into the answer, which is kind of over-focused mini-lesson when the rest of the post just lists the problems briefly.
another expert: adds a comment with length limit and no para breaks that recaps his favorite reason.
someone else: adds a comment giving a link to a detailed “why” post on SO or elsewhere, if he happens to take the trouble to look it up again.
Don’t write naked
Prefer non-member functions for
Why is well beyond the scope of the question, but you should learn it the right way and you’ll be glad later. Oh, and here’s the needed two-step way you need to do it.
Again, a detailed explanation here can run to several paragraphs and gets too deep and breaks the flow since this is not a single-issue answer. Some things need single-issue answers to explain properly.