Degraded C++ error messages.
Matt Austern
austern@apple.com
Sat Nov 8 22:36:00 GMT 2003
On Nov 8, 2003, at 2:22 PM, Carlo Wood wrote:
> On Fri, Nov 07, 2003 at 10:28:33PM +0100, Gabriel Dos Reis wrote:
>> That is what I call expression-based messages. Sorry if I didn't
>> word it
>> clearly.
>
> About "how to format the error messages", I'd like to suggest
> the following.
>
> An error message should be as short as possible, yet still
> specify what exactly is "the problem". This means that
> a clear descriptive message needs to be output that differentiates
> the different places in the gcc source code (equivalent to
> the different types of "problems") and that somehow a reference
> needs to put in that message that point to the "objects"
> involved. Especially those object references need to be as
> short as possible imho.
I don't think that's a good enough rule of thumb when it
come to templates. The trouble is that a template error
involves the interaction of (at least) two difference
pieces of source code: the template definition, and the
environment where the template is instantiated. From a
human's point of view it's usually not that hard to tell
the difference between an incorrect template definition
and an incorrect use of a correct template, but for
compilers it's harder.
The "concept" proposal that Bjarne and Gaby are working
on should help to some extent. But in the mean time
there's no real choice but to give error messages that
contain enough information so that they can be used to
tell what's wrong regardless of whether the error is in
the template definition or the template instantiation.
Hundred-line error messages are awful, but I don't think
we have a choice yet.
--Matt
More information about the Libstdc++
mailing list