[C++-sig] Re: Pyste suggestion for handling returns of void *

David Abrahams dave at boost-consulting.com
Sat Oct 4 14:02:43 CEST 2003

"Niall Douglas" <s_sourceforge at nedprod.com> writes:

> Boost.Python won't process a method returning void * nor will it 
> permit you to set a typedef void *voidptrtype; to an opaque type :( 
> Unfortunately some methods in my code return void *'s where you don't 
> actually need the return value at all (it's just useful)! This makes 
> things difficult for automated wraps.
> I suggest getting pyste to cast any methods returning a void * to 
> return void instead. I figure most architectures return their value 
> in a register so theroretically casting a function pointer to not 
> return anything shouldn't cause stack frame corruption.

I hope Nicodemus will refuse to do that, since calling through such a
cast function pointer causes undefined behavior.


> This probably leaves out virtual functions and may cause problems 
> with getting the address of overloaded methods. Still some support 
> for void * returns is better than none.

This isn't what I'd call "support for void* returns".  We should
return and accept void*s as opaque pointers.

Dave Abrahams
Boost Consulting

More information about the Cplusplus-sig mailing list