Title
C++ library should define ssize_t
Status
nad
Section
[support.types]
Submitter
Matt Austern

Created on 2013-04-19.00:00:00 last changed 108 months ago

Messages

Date: 2015-05-22.19:38:14

Proposed resolution:

  1. Ammend [support.types], Table 30 as indicated:

    Table 30 — Header <cstddef> synopsis
    Type Name(s)
    Macros: NULL offset_t
    Types: ptrdiff_t ssize_t size_t max_align_t nullptr_t

    Add the following paragraph to describe ssize_t

    -?- The type ssize_t is an implementation-defined signed integer type that shall contain the minimum range [-1, {SSIZE_MAX}] where SSIZE_MAX is specified at a minimum of _POSIX_SSIZE_MAX.

    Ammend p7 as follows:

    -7- [Note: It is recommended that implementations choose types for ptrdiff_t, ssize_t, and size_t whose integer conversion ranks …

Date: 2015-05-22.19:38:14

[ Lenexa 2015-05-05: NAD - no consensus for a change ]

Billy : ssize_t that was promised to be signed, was based on rsize_t from safe secure C

NM : ssize_t s ptrdif_t

Z : ptrdiff_t is full range, ssize_t has only -1 as negative value

Billy : motivations for ptrdiff_T, ssize_t and rsize_T all fuzzy. - Reads rsize max -

NM : ptrdiff_T not big enough to rep difference of pointers anymore

STL : description incorporates posixisms

Billy : Don't need it

NM : rather remove it from footnote

Z : Name has precise meaning

STL : everyone understands ptrdiff_t is signed counterpart to size_t

Billy : Not in all implementations anymore

DK : footnote says something different from ...

Z/NM : off_t historically tainted

STL : we have a type trait to make signed version of size_t. we should just use that

MC : NAD; is feature request

TP : It's not cstdsef

Date: 2013-09-15.00:00:00

[ 2013-09-29, Suggested wording from Jayson Oldfather ]

I decided to use the phrase to describe ssize_t below because of the text describing it in the POSIX standard. In it, it describes ssize_t with the value range of [-1,{SSIZE_MAX}]. SSIZE_MAX is specified in the POSIX standard as a minimum value of _POSIX_SSIZE_MAX. This macro is referenced in the wording below.

Date: 2013-09-29.19:32:18

The C++ standard library defines size_t, a typedef for an implementation defined unsigned integer type that can represent the sizes of objects. The POSIX standard augments this with ssize_t, a typedef for a signed integer type that corresponds to size_t.

The ssize_t typedef is useful — useful enough that the C++ standard even refers to it. (In a non-normative footnote in [stream.types].) Also, lots of OS vendors add it to their headers anyway, even though it isn't part of the C or C++ standards, because those vendors are trying to define headers that conform to multiple standards at once. We should make users' and implementers' lives easier by adding ssize_t to [support.types].

History
Date User Action Args
2015-05-22 19:38:14adminsetmessages: + msg7441
2015-05-22 19:38:14adminsetstatus: new -> nad
2013-09-29 19:32:18adminsetmessages: + msg6668
2013-09-29 18:43:42adminsetmessages: + msg6667
2013-04-19 00:00:00admincreate