Title
Missing requirements for smart-pointer safety API
Status
c++11
Section
[depr.util.smartptr.shared.atomic]
Submitter
Alisdair Meredith

Created on 2009-03-11.00:00:00 last changed 162 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

In section "shared_ptr atomic access" [util.smartptr.shared.atomic], add to each function the following clause.

Requires: p shall not be null.

Date: 2010-10-21.18:28:33

[ 2009-10 Santa Cruz: ]

Moved to Ready.

Date: 2009-09-20.00:00:00

[ 2009-09-20 Lawrence provided wording: ]

The parameter types for atomic shared pointer access were deliberately chosen to be pointers to match the corresponding parameters of the atomics chapter. Those in turn were deliberately chosen to match C functions, which do not have reference parameters.

We adopt the second suggestion, to require that such pointers not be null.

Date: 2010-10-21.18:28:33

[ 2009-07 post-Frankfurt: ]

Lawrence explained that these signatures match the regular atomics. The regular atomics must not use references because these signatures are shared with C. The decision to pass shared_ptrs by pointer rather than by reference was deliberate and was motivated by the principle of least surprise.

Lawrence to write wording that requires that the pointers not be null.

Date: 2010-10-21.18:28:33

[ Summit: ]

Agree. All of the functions need a requirement that p (or v) is a pointer to a valid object.

Date: 2012-10-21.13:19:07

Addresses JP 44 [CD1]

The 1st parameter p and 2nd parameter v is now shared_ptr<T>*.

It should be shared_ptr<T>&, or if these are shared_ptr<T>* then add the "p shall not be a null pointer" at the requires.

History
Date User Action Args
2011-08-23 20:07:26adminsetstatus: wp -> c++11
2010-10-21 18:28:33adminsetmessages: + msg393
2010-10-21 18:28:33adminsetmessages: + msg392
2010-10-21 18:28:33adminsetmessages: + msg391
2010-10-21 18:28:33adminsetmessages: + msg390
2010-10-21 18:28:33adminsetmessages: + msg389
2009-03-11 00:00:00admincreate