cni-changes documented?
Tom Tromey
tromey@redhat.com
Fri Mar 19 05:06:00 GMT 2004
>>>>> "Hans" == Boehm, Hans <hans.boehm@hp.com> writes:
Hans> (I'm not sure whether the smart pointers to implement
Hans> null-pointer checks are implemented as C++ source.)
Hans> At least in my experience, a general problem with C++ "smart pointers"
Hans> is that they only behave 95% like pointers, and it's usually still
Hans> possible to get premature deallocation if you try, or if you try to
Hans> manually optimize too aggressively.
I think our plan for smart pointer is just a very thin wrapper around
the pointer to do null checking:
template<typename T>
class ref
{
private:
T *val;
public:
... constructors and stuff...
T *operator () const
{
#ifdef NO_SEGV_HANDLER
if (! val) throw new NullPointerException();
#endif
return val;
}
};
The hope is that the overhead from this approach will be very small.
Tom
More information about the Java
mailing list