Title
Ambiguous references to size_t
Status
cd1
Section
[library]
Submitter
Al Stevens

Created on 1999-08-15.00:00:00 last changed 172 months ago

Messages

Date: 2010-10-21.18:28:33

[ pre-Copenhagen: Nico has reviewed the changes and believes them to be correct. ]

Date: 2010-10-21.18:28:33

[ Toronto: This is tangentially related to issue 229, but only tangentially: the intent of this issue is to address use of the name size_t in contexts outside of namespace std, such as in the description of ::operator new. The proposed changes should be reviewed to make sure they are correct. ]

Date: 2010-10-21.18:28:33

[ Post-Tokyo: Nico Josuttis provided the above wording at the request of the LWG. ]

Date: 2010-10-21.18:28:33

Rationale:

The LWG believes correcting names like size_t and ptrdiff_t to std::size_t and std::ptrdiff_t to be essentially editorial. There there can't be another size_t or ptrdiff_t meant anyway because, according to [extern.types],

For each type T from the Standard C library, the types ::T and std::T are reserved to the implementation and, when defined, ::T shall be identical to std::T.

The issue is treated as a Defect Report to make explicit the Project Editor's authority to make this change.

Date: 2010-10-21.18:28:33

Proposed resolution:

In [replacement.functions] paragraph 2: replace:

- operator new(size_t)
- operator new(size_t, const std::nothrow_t&)
- operator new[](size_t)
- operator new[](size_t, const std::nothrow_t&)

by:

- operator new(std::size_t)
- operator new(std::size_t, const std::nothrow_t&)
- operator new[](std::size_t)
- operator new[](std::size_t, const std::nothrow_t&)

In [lib.allocator.requirements] 20.1.5, paragraph 4: replace:

The typedef members pointer, const_pointer, size_type, and difference_type are required to be T*, T const*, size_t, and ptrdiff_t, respectively.

 by:

The typedef members pointer, const_pointer, size_type, and difference_type are required to be T*, T const*, std::size_t, and std::ptrdiff_t, respectively.

In [lib.allocator.members] 20.4.1.1, paragraphs 3 and 6: replace:

3 Notes: Uses ::operator new(size_t) (18.4.1).

6 Note: the storage is obtained by calling ::operator new(size_t), but it is unspecified when or how often this function is called. The use of hint is unspecified, but intended as an aid to locality if an implementation so desires.

by:

3 Notes: Uses ::operator new(std::size_t) (18.4.1).

6 Note: the storage is obtained by calling ::operator new(std::size_t), but it is unspecified when or how often this function is called. The use of hint is unspecified, but intended as an aid to locality if an implementation so desires.

In [lib.char.traits.require] 21.1.1, paragraph 1: replace:

In Table 37, X denotes a Traits class defining types and functions for the character container type CharT; c and d denote values of type CharT; p and q denote values of type const CharT*; s denotes a value of type CharT*; n, i and j denote values of type size_t; e and f denote values of type X::int_type; pos denotes a value of type X::pos_type; and state denotes a value of type X::state_type.

by:

In Table 37, X denotes a Traits class defining types and functions for the character container type CharT; c and d denote values of type CharT; p and q denote values of type const CharT*; s denotes a value of type CharT*; n, i and j denote values of type std::size_t; e and f denote values of type X::int_type; pos denotes a value of type X::pos_type; and state denotes a value of type X::state_type.

In [lib.char.traits.require] 21.1.1, table 37: replace the return type of X::length(p): "size_t" by "std::size_t".

In [lib.std.iterator.tags] 24.3.3, paragraph 2: replace:
    typedef ptrdiff_t difference_type;
by:
    typedef std::ptrdiff_t difference_type;

In [lib.locale.ctype] 22.2.1.1 put namespace std { ...} around the declaration of template <class charT> class ctype.

In [lib.iterator.traits] 24.3.1, paragraph 2 put namespace std { ...} around the declaration of:

    template<class Iterator> struct iterator_traits
    template<class T> struct iterator_traits<T*>
    template<class T> struct iterator_traits<const T*>

Date: 1999-08-15.00:00:00

Many references to size_t throughout the document omit the std:: namespace qualification.

For example, [replacement.functions] paragraph 2:

 operator new(size_t)
 operator new(size_t, const std::nothrow_t&)
 operator new[](size_t)
 operator new[](size_t, const std::nothrow_t&)
History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg1779
2010-10-21 18:28:33adminsetmessages: + msg1778
2010-10-21 18:28:33adminsetmessages: + msg1777
2010-10-21 18:28:33adminsetmessages: + msg1776
2010-10-21 18:28:33adminsetmessages: + msg1775
1999-08-15 00:00:00admincreate