1098. definition of get_pointer_safety()

Section: 23.10.5 [util.dynamic.safety] Status: C++11 Submitter: Jens Maurer Opened: 2009-04-03 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [util.dynamic.safety].

View all issues with C++11 status.

Discussion:

Addresses DE 18

In 23.10.5 [util.dynamic.safety], get_pointer_safety() purports to define behavior for non-safely derived pointers (6.6.4.4.3 [basic.stc.dynamic.safety]). However, the cited core-language section in paragraph 4 specifies undefined behavior for the use of such pointer values. This seems an unfortunate near-contradiction. I suggest to specify the term relaxed pointer safety in the core language section and refer to it from the library description. This issue deals with the library part, the corresponding core issue (c++std-core-13940) deals with the core modifications.

See also N2693.

[ Batavia (2009-05): ]

We recommend if this issue is to be moved, the issue be moved concurrently with the cited Core issue.

We agree with the intent of the proposed resolution. We would like input from garbage collection specialists.

Move to Open.

[ 2009-10 Santa Cruz: ]

The core issue is 853 and is in Ready status.

Proposed resolution:

In 23.10.5 [util.dynamic.safety] p16, replace the description of get_pointer_safety() with:

pointer_safety get_pointer_safety();

Returns: an enumeration value indicating the implementation's treatment of pointers that are not safely derived (3.7.4.3). Returns pointer_safety::relaxed if pointers that are not safely derived will be treated the same as pointers that are safely derived for the duration of the program. Returns pointer_safety::preferred if pointers that are not safely derived will be treated the same as pointers that are safely derived for the duration of the program but allows the implementation to hint that it could be desirable to avoid dereferencing pointers that are not safely derived as described. [Example: pointer_safety::preferred might be returned to detect if a leak detector is running to avoid spurious leak reports. -- end note] Returns pointer_safety::strict if pointers that are not safely derived might be treated differently than pointers that are safely derived.

Returns: Returns pointer_safety::strict if the implementation has strict pointer safety (6.6.4.4.3 [basic.stc.dynamic.safety]). It is implementation-defined whether get_pointer_safety returns pointer_safety::relaxed or pointer_safety::preferred if the implementation has relaxed pointer safety (6.6.4.4.3 [basic.stc.dynamic.safety]).Footnote

Throws: nothing

Footnote) pointer_safety::preferred might be returned to indicate to the program that a leak detector is running so that the program can avoid spurious leak reports.