This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

templates lead to horrendous error messages


Hi Folks,

   Allow me to pick a nit: lately I've gotten fancy with templates,
   which means that now if I screw something up (like forgetting to
   put a .c_str() on the end of a string when sending it off to a
   function that wants a char*), I get error messages that look like
   this:

GetOptions.C: In function `class map<basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >,basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >,less<basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > >,__default_alloc_template<false,0> > GetOptions(const class basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> > &, int, char **, void (*)())':
GetOptions.C:102: cannot convert `parse.vector<basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >,__default_alloc_template<false,0> >::operator [](unsigned int)(1)' from type `basic_string<char,string_char_traits<char>,__default_alloc_template<false,0> >' to type `const char *'

   which is completely unreadable. Is there any way of coercing the
   compiler to generate error messages in terms of typedefs instead of
   the 'real' type? Because that would make the above error message
   look something like

In function `option_map GetOptions (const string& command_line_syntax,
int argc, char** argv, help_fn help)`: 
GetOptions.C:102: cannot convert parse.vector<string>::operator[] from
type `string` to type `const char*`

   which is rather more useful.

   Is such a thing possible?

   THANKS!

--------------------------------------------------------------------------
Dave Steffen                      Wave after wave will flow with the tide
Dept. of Physics                    And bury the world as it does
Colorado State University         Tide after tide will flow and recede
steffend@lamar.colostate.edu        Leaving life to go on as it was...
							- Peart / RUSH
"The reason that our people suffer in this way.... 
is that our ancestors failed to rule wisely".   -General Choi, Hong Hi





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]