[GCC-XML] Default parameter values in member functions of templated classes.
Roman Yakovenko
roman.yakovenko at gmail.com
Tue Feb 26 01:54:18 EST 2008
On Tue, Feb 26, 2008 at 8:27 AM, Bryan Ischo <bji-gccxml at ischo.com> wrote:
> Brad King wrote:
> > I think what happens is that GCC's expression-to-string conversion is
> > designed to be used during error message construction. GCC error
> > messages look like this:
> >
> > error: initializing argument 1 of 'std::basic_string<_CharT,
> > _Traits, _Alloc>::basic_string(const _CharT*, const _Alloc&) [with
> > _CharT = char, _Traits = std::char_traits<char>, _Alloc =
> > std::allocator<char>]'
> >
> > (the code tried to construct std::string(1) which is an error). Note
> > that the prototype is given with the template formal parameters
> > instead of the actual arguments. Then the rest of the message maps
> > the parameters to their values. GCC-XML is using the same
> > expression-to-string functionality from GCC. This is not the only
> > limitation of the expression-to-string conversion that people have
> > encountered. In general I think the "default" attribute is useful
> > mostly for human reference.
>
> Can you elaborate on the other limits in the expression-to-string
> conversion that people have encountered? It would help me to know about
> these things instead of discovering them later on myself.
>
> As to the utility of correct default attributes - I had wanted to use
> the text in the default attribute directly in generated C++ code, but it
> wasn't working for defaults like the problematic one I wrote about. So
> I scrapped that, and instead just give the user the text string of the
> default value to do with what they will. It's just for completeness of
> my API (the xrtti "extended runtime typing for C++" system) that I want
> to be able to provide programmatic representations of the defaults to
> the API users, not because I have any particular use case in which valid
> default values would be useful. Perhaps I should submit a feature
> request in the gccxml bug database for better expression-to-string
> handling, especially with regards to default values?
>From my experience only "very simple" default value expressions work.
"Very simple" defined as POD, default constructor of non template class.
For more information I suggest to take a look on issues I have
http://language-binding.net/pygccxml/upgrade_issues.html#free-and-member-function-default-arguments
and solution for some of them:
http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pygccxml_dev/pygccxml/parser/patcher.py?revision=1128&view=markup
HTH
--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
More information about the gccxml
mailing list