Topic: Error messages


Author: "Igor A. Goussarov" <igusarov@akella.com>
Date: Wed, 25 Jul 2001 21:06:31 GMT
Raw View
Hello group,

   I want to address a question of generating diagnostic messages by
compilers. Let's start from the situation when the program development
(both core library, both CP code) doesn't involve intensively templated
code.
   Then if the core code was compiled without errors, it can be put in a
library and used by other developers. Their code includes just the
headers of the said library (i.e. function prototypes and class
declarations). If the compilation of their units fail, then it's quite
easy to track what has caused the compilation error, because the error
is most likely in their code.
   The situation is different if the code uses a lot of templates. The
author of the template can ensure that the template class compiles
without errors and test its behavior in some tests. But when he deploy
the code to the others and they are trying to instantiate this template
for a variety of parameters, the usual error messages are of little
help: the place and description of the error often has very little to do
with the actual cause of error. The error can be due to an incorrect
invocation of a template by a CP, or due to a bug in the core code - but
in both cases the compiler will diagnose an 'immediate' error.
   What can one say if after making some modifications to the code the
compiler presents him with a hundred of ambiguity errors detected in a
completely irrelevant (at first glance) single-line helper member
function? Of course, there are 'good' compilers like g++ that show the
history of template instantiations that has lead to the error. This is
helpful, but is not obligatory according to the standard.
   Are there any thoughts about improving the diagnostic system? I mean,
strict standardization of error message texts will not be useful, but
I'd like to see something that would enforce the compilers to emit more
useful diagnostics for templates. Does it make sense?

Igor

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]