Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 153 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

I recently failed a close audit on "The operator -> in c++": When the question was presented, it showed -3 votes and I thought the voting members were being a bit harsh on a new user learning C++.

In the post, the OP stated "I did not find any helpful explanation about this operator on the internet". In fact, Stack Overflow did not offer similar useful results:

Stack Overflow suggestions

Searching Google for "c++ 'operator->'" did not return a lot of results as expected (perhaps the "->" is complicating results). Also, searching for "c++ 'operator->'" did not return many hits either (the most popular was the a humorous post on if (x --> 0).

I performed the search myself, so I believe the OP was truthful when he stated he was having trouble finding information on it. I performed the two search because I suspected the question was a duplicate, and I wanted to point him to the correct post.

After the audit results, I see there are -9 votes and the question was closed because it was too broad.

I'd like to point out that "operator->" is the member access operator, and it does not seem to be very broad a topic to me. In fact, searching Google for "c++ member access operator" returned quality results, and many of the top results did a great job of explaining it in a couple of paragraphs.

Perhaps I'm taking something for granted here. Would someone explain to me what is too broad about the question and potential 1- or 2-paragraph answers?

Or is this a case of senior and voting members hunting in packs and this should apply: Could we please be a bit nicer to new users?.

And now I'm faced with STOP! Look and Listen shown below. I don't agree with it, so I don't want to click "I understand". I don't want to click it because I'm fairly certain its a case of the senior or voting members being jerks to a new user and hunting in packs.

I Understand dialog

EDIT: An image of Stack Overflow's suggested questions was added to show how difficult it can be to get search results when the search term includes symbols.

share|improve this question
By the way, operators are easy to find in an operator precedence chart. There's also Symbol Hound for searching things that Google strips out. – chris Jan 14 '14 at 5:04
Thanks Chris. "... operator precedence chart" - yes, that's where I found the proper name for it ("member access operator"). I don't think the OP would have known to look for it there, though. – jww Jan 14 '14 at 5:10
True, both are very good resources, but also not well-known to new programmers. The operator precedence chart is a great summarized list that works for every language once you do pick up on it, though. – chris Jan 14 '14 at 5:11
up vote 16 down vote accepted

Requests for detailed tutorials are Too Broad, by definition.

The full close reason (I've bolded the relevant portion):

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.

The problem here is the level of knowledge of the asker. The OP says he's new to C++, so any explanation of the operator would have to explain the involved language elements in detail, in order to cover all of the fundamental knowledge that would be required to understand the operator. That makes the question too broad, and more appropriate for a book or language tutorial.

See Also

share|improve this answer
But the answer was not a detailed tutorial, and any one with voting rights and C++ experience should have known that (otherwise, what are they doing voting?). The poster was clearly new to the programming language (he even stated such), and he did not know what to ask for. Why was the question not edited to remove the faux pax and rephrased as "Could someone explain it to me". Isn't that what the senior folks are supposed to do here? – jww Jan 14 '14 at 4:39
Does that minor change in wording really change the nature of the question at all? It's a "teach me this" question. No, you need to go read a book and gain some basic understanding of the language first. – Robert Harvey Jan 14 '14 at 4:40
No, the wording change change makes no difference. The fellow did no know what the member access operator was, and he needed a simple explanation. Not an attack. – jww Jan 14 '14 at 4:41
It turns a too broad question to an answerable one. Was the OP notified he should make such change himself (if too radical from a community) lest his question is closed? – Jan Dvorak Jan 14 '14 at 4:42
Nobody is attacking here. What attack? Downvotes are not attacks. Read the tooltip that you get when you hover over the downvoting button; it says: This question doesn't show research effort; it is unclear or not useful. – Robert Harvey Jan 14 '14 at 4:43
Are you sure the "not useful" part applies? "unclear" doesn't, and OP claims he has done some "research". – Jan Dvorak Jan 14 '14 at 4:45
See the update to my answer. – Robert Harvey Jan 14 '14 at 4:46
@Robert - I'm not sure if I should accept here (I'm not being rude). Someone asking for a "detailed tutorial on C/C++ socket programming" is clearly too broad, and I would agree if someone ask for the "detailed tutorial". I really feel this fellow just phrased it wrong because the answer was not a "detailed tutorial". – jww Jan 14 '14 at 4:48
That wording doesn't make any difference. The nature of the question does. The comment below the question is probably the best possible answer, but that's not really an explanation, and it's not going to make sense to someone who doesn't already have a good grounding in the language fundamentals. – Robert Harvey Jan 14 '14 at 4:50
"so any explanation of the operator would have to explain the involved language elements in detail" - makes sense, thanks. Would this question be a good or acceptable question if these two parts ("I'm a newbie" and "Please post a full tutorial") were removed? – Jan Dvorak Jan 14 '14 at 4:50
@JanDvorak: The problem with that is that the answerer is now put into the position of guessing what the asker's level of expertise is, which puts the question into "Unclear What you are Asking" territory. Honestly, I'd love to see more questions like this, but I don't know how to make them work. Invariably the people who ask them follow up with a barrage of other questions. – Robert Harvey Jan 14 '14 at 4:54
If we can't judge the asker's level of expertise, shouldn't we be answering for the general audience, and choose a level of explanation such that the answer is reasonably sized if the question is potentially widely useful? – Jan Dvorak Jan 14 '14 at 4:57
@Robert (1/3): "good answers would be too long" - I think there is a slippery slope here. I believe an answer that is "too long" is not applicable in this instance. See, for example, Member Access Operators: . and ->. It was two paragraphs with an example. – jww Jan 14 '14 at 5:47
@Robert (2/3): "good answers would be too long" - Dissertations are sometimes written, and I hope that does not imply long answers are not desired on the site. See, for example,… and…. And why should another decide that OP is not deserving of a long answer? Or its not worth my time or effort to provide a long answer? – jww Jan 14 '14 at 5:47
@Robert (3/3): "there are either too many possible answers..." - I think the most offensive thing in this instance is no one even bothered trying to find a duplicate of the question (if there were indeed all those possible answers covering member access in C++). It appears to me a bunch of folks just hoped on the band wagon because they felt the question was not worthy of their time. If it would have been closed as a duplicate, I would not have complained. – jww Jan 14 '14 at 5:48

At least if this were tagged as C rather than C++, @Jefffrey would theoretically be sort of right: the answer to this would be extremely narrow and simple, requiring only a one-liner as an answer.

In reality, however, any decent book on C or C++ is going to cover the -> operator and how a->b is equivalent to (*a).b, typically in its chapter on structs or classes (e.g., Chapter 6 of K&R2). That leaves only one reasonable conclusion: the OP hasn't studied or read through enough of a textbook on C or C++ to have learned its basic syntax and operators.

That being the case, to be complete enough to be meaningful, an answer would really need to start with (at least) what a struct and/or class is, and the basics of member access. Then it would have to go into pointers (or it could go into pointers first, then structs), and finally how -> relates a pointer to a member.

In other words, the answer has just expanded from one line to chapters 5 and 6 of K&R2. Worse, K&R2 is (justifiably) known for being unusually terse, so if we were looking at another book on the subject, we might easily find that material filling 100 pages or more--easily the size of many small books.

That only covers the answer for C though. The comment Jefffrey cites:

a->b is the same as (*a).b . End of story.

Is simply false with respect to C++. C++ adds two more dimensions to the problem: first, the claimed equivalence of operators doesn't necessarily hold true because operator-> can be overloaded. Second, overloading operator-> isn't quite like overloading other operators. The full technical details of that aren't really relevant here, but suffice it to say that just talking about the unusual characteristics of an overloaded operator-> could be (at least) sufficiently broad for a question and answer on SO. In a decent textbook it would probably be a lot less than 100 pages, but would probably fill most of a page in even a very tersely written book and might easily occupy a half dozen pages in some of the more verbosely written books.

Bottom line: an answer that's complete enough to be meaningful really is much longer than is reasonable for SO, and would basically involve reproducing a significant portion of a normal text book on C, and a smaller (but still far from insubstantial) portion of a text book on C++.

share|improve this answer
Well, Microsoft managed to do it in two paragraphs with one example at Member Access Operators: . and ->. And its well known Microsoft is not as smart as Stack Overflow folks ;) – jww Jan 14 '14 at 6:33
To play devil's advocate: what if the fellow knew what the dot "." member access operator was from Java, Javascript, <favorite language>, and he wanted to know about pointer "->" member access in C++? – jww Jan 14 '14 at 6:34
@noloader: Under precisely the correct circumstances, yes, it can be covered in very little space. Unless, however, the question specifies the correct circumstances, an answer can't (or shouldn't) assume them. Also note that the cited paragraphs do not describe anything about an overloaded operator-> in C++ (which, as I pointed out, deserves some space of its own, because it overloads differently from other operators). – Jerry Coffin Jan 14 '14 at 6:35
Thanks Jerry. Robert found a similar question and marked it as a duplicate. My blood pressure has dropped considerably. See C++: Using Arrow Member Operator. Now I'd like to close it as a duplicate !^**^! – jww Jan 14 '14 at 6:45
@noloader: yup -- nice find on his part. Since none of the answers to that question covered the unusual aspects of overloading operator-> in C++, I've added another answer there that at least attempts to do so. – Jerry Coffin Jan 14 '14 at 7:25

I'm gonna start this answer with a quote (from jalf) from the Lounge<C++>:

Don't you know downvotes are shorthand for expression "I know more about programming than you"?

You can easily replace or add "close votes" in there and use it in the current context.

I strongly disagree with the overall opinion of Robert Harvey and those who voted to close it.The question has been closed with the "too broad" reason, but how does:

There are either too many possible answers, or good answers would be too long for this format.

apply here? How can there be too many possible answers in "explain operator-> to me"? It's a trivial question and I'm surprised it's not a duplicate (because that's the only reason I could agree to close it on), but it's not a bad question.

An acceptable answer has been given as a comment:

a->b is the same as (*a).b . End of story.

How is this long? You can even add a few hint to the fact that -> is actually operator-> that can be overloaded; maybe throw in some links to some famous "operators in C++" question here on SO and be done with it.

I don't see how can't a short answer be given here.

Then again, quoting Harvey:

The OP says he's new to C++, so any explanation of the operator would have to explain the involved language elements in detail, in order to cover all of the fundamental knowledge that would be required to understand the operator.

A tutorial on the operator-> seems pretty narrow. The above can apply to questions in the form of "What are operators in C++". Not to "Explain operator-> to me".

share|improve this answer
It's not always about the context of the question but about general rule of thumb. A question like explain 1+1=2 to me would have possibly been closed as too broad by todays standards. – user221081 Jan 14 '14 at 12:17

You must log in to answer this question.

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