[C++-sig] Re: Retiring "ref", etc.
david.abrahams at rcn.com
Wed Jun 12 01:23:28 CEST 2002
From: "Dave Hawkes" <daveh at cadlink.com>
> Another awkward twist is that some of the python API functions accept a
> PyObject* as a valid parameter.
Not according to Guido:
> Which implies a 'NULL' reference should be
> allowed which is not symantically an error condition. However I don't
> there any functions that can return a valid NULL apart from some of the
> MACRO versions with no error checking.
> I don't think it is unreasonable to construct a new smart pointer that
> a NULL pointer as it currently does.
> However for return values may be we should have a different smart pointer
> called something like result_reference. We can then allow conversions
> between the two that would check if result_reference was valid, before
> converting to a regular reference.
I'm thinking that return values of Python API wrappers should always return
"object", which has a builtin check for null that throws.
More information about the Cplusplus-sig