On 5 July 2012 13:10, Joel Uckelman <uckel...@nomic.net> wrote:

> Do you know why Boost Python complains about returning a char const*?
>

When returning a pointer, you have to tell Boost::Python what to do with
it. The most important issue is one of ownership. Once the pointer has been
returned as a Python object in the Python world, and that object goes out
of scope, what should happen with the pointer? Is it owned by Python and
should the pointed-to memory be deallocated too? Or was it still owned by
the function that returned it? This is what you have to tell Boost::Python
before it allows you to return pointers. And this is also why I looked for
a solution that didn't involve pointers - much easier to understand as a
first example.


> It's a strange thing to have for the first example in the docs if it won't
> compile.


I agree. Personally I can't do anything about that, though.

-- 
Sybren A. Stüvel

http://stuvel.eu/
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to