[C++-sig] Re: Retiring "ref", etc.
David Abrahams
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
NULL
> PyObject* as a valid parameter.
Not according to Guido:
http://aspn.activestate.com/ASPN/Mail/Message/python-dev/1235121
> Which implies a 'NULL' reference should be
> allowed which is not symantically an error condition. However I don't
think
> 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
holds
> 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.
-Dave
More information about the Cplusplus-sig
mailing list