Looking at several posts, I get a feel that many of the questions arise because compilers/implemenetation do not emit a very meaningful message many times (but not always). This is especially true in the case of templates where error messages could be at the least very daunting. A case in point could be the discussion topic
Therefore, I would like to understand a few things:
a) Why is it that compilers are sometimes unable to give more meaningful/helpful error messages? Is the reason purely practical or technical or is there something else. (I don't have a compiler background)
b) Why can't they give a reference to the most relevant conforming C++ Standard Verse/section, so that developer community can learn C++ better?
EDIT:
Refer the thread here for another example.
EDIT:
Refer the thread here for another example.
A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. --- Douglas Adams
I'll try to explain some rationale behind diagnostics (as the standard calls them):
a) Why is it that compilers are sometimes unable to give more meaningful/helpful error messages?
Compilers are bound to obey the standard. The standard defines more or less everything that the compiler needs to diagnose (e.g. syntax errors) because these are invariants, stuff that the vendor needs to document (called implementation defined as the vendor has some leeway as to how to document), stuff they call unspecified (the vendor can get away without documenting) and then undefined behavior (if the standard can't define it, what error message can the compiler possibly spit out?).
b) Why can't they give a reference to the most relevant conforming C++ Standard Verse/section, so that developer community can learn C++ better?
Not everyone has a copy of the standard.
Instead, what the compiler tries to do is group errors by categories and then fixes a human-understandable error message that is generic enough to handle all sorts of errors in that category while still being meaningful.
Also, not all compilers are standards compliant. Sad, but true.
Some compilers implement more than
one standard. Do you really expect
them to quote C&V of 3 standards
texts for a simple "missing ;
"
error?
Finally, the standard is terse and less human readable than the committee would like to think (okay, this is a tongue-in-cheek remark but reflects the state of affairs pretty accurately!)
And read the quote at the top once more ;)
PS: As far as template error messages are concerned, I have to offer the following: