Re: [pygccxml-development] Handling of enum value as default for parameter
Brought to you by:
mbaas,
roman_yakovenko
From: Patrick H. <pat...@pr...> - 2008-06-25 18:17:07
|
On Jun 25, 2008, at 12:42 PM, Roman Yakovenko wrote: > On Wed, Jun 25, 2008 at 7:35 PM, Patrick Hartling > <pat...@pr...> wrote: >> I have run into a case where Py++ is generating C++ code that does >> not >> compile, and I am trying to determine if the problem lies with GCC- >> XML or >> Py++. Code demonstrating what I am working with is attached. What >> happens is >> that Py++ creates code for Y::setValue() similar to the following: >> >> Y_exposer.def("setValue", &Y::setValue, (bp::arg("v") = (int)(V1))); >> >> The use of X::V1 requires scoping in order to compile, but this is >> not >> happening. This is occurring with GCC-XML built from CVS HEAD >> sources as of >> yesterday and Py++ and PyGCCXML r1348. The relevant XML is shown >> below: >> >> <Method id="_151" name="setValue" returns="_134" context="_124" >> access="public" mangled="_ZN1Y8setValueEi" >> demangled="Y::setValue(int)" location="f1:10" >> file="f1" line="10" extern="1"> >> <Argument name="v" type="_129" location="f1:10" file="f1" >> line="10" default="V1"/> >> </Method> >> >> Should Py++ be resolving the scope of X::V1, or should GCC-XML do >> that up >> front? > > In general, there is a problem with default values. GCCXML is not able > to dump a C++ expression and in many cases it dumps some garbage. For > example take a look on next page: > > http://language-binding.net/pygccxml/upgrade_issues.html#free-and-member-function-default-arguments > > This link also suggest you simple work around. It is suitable, if you > have only few functions. Take a look on this page > http://language-binding.net/pyplusplus/documentation/functions/default_args.html > for more options supported by Py++. That is very helpful. Thank you for the pointers. -Patrick -- Patrick L. Hartling Senior Software Engineer, Priority 5 http://www.priority5.com/ |