Public Comment Number PC-UK0263 ISO/IEC CD2 9899 (SC22N2794) Public Comment =========================================== Date: 1998-09-22 Author: N.M Maclaren Author Affiliation: Self Postal Address: University of Cambridge, Computer Laboratory, New Museums Site, Pembroke Street, Cambridge CB3 3QG, United Kingdom E-mail Address: Telephone Number: +44 1223 334761 Fax Number: +44 1223 334679 Category: Feature that should be included Committee Draft subsection: 7.18.3 and 7.19.1 Title: Support for data management Detailed description: Because of the change in the status of the long and unsigned long types, there is a need for an efficient data type that can be used to perform calculations on mixed file sizes and data object sizes. The obvious candidate is to define an off_t that is compatible with POSIX, but which makes sense on non-POSIX systems. The following should be added to 7.19.1 after paragraph 2: off_t which is a signed integer type of integer conversion rank not less than that of any of long, size_t or ptrdiff_t, and capable of holding both the size of any object allocated by the malloc function (7.20.3.3) and the maximum number of bytes that a conforming application can write to a file opened with mode "wb+" and read back again in an arbitrary order. Recommended practice The off_t type should be capable of holding the total size of all accessible objects at any instant during the execution of a program. The reason for the above (apparently contorted) wording is to allow off_t to be a 32-bit type on a system where long, size_t, ptrdiff_t and the size of files are all 32-bit quantities (e.g. traditional Unix), but to require it to be longer if any of those are larger or if any single object larger than 2 GB can actually be allocated. Note that Unix pipes and similar objects have never had a definite limit on their size. The following should be added to 7.18.3: OFF_MIN -2147483647 OFF_MAX +2147483647 Note that POSIX defines off_t to be only a signed arithmetic type, and not an integer one, but traditional practice (and consistency) requires that it be integral. To the best of my knowledge, no implementation that conforms with POSIX has ever defined off_t to be a floating type. The above specification is therefore what existing POSIX practice is, though framed in words that are not specific to POSIX. This type should also have a flag character defined for use in conversion specifiers in 7.19.6.1, 7.19.6.2, 7.24.2.1, 7.24.2.2. As the obvious letters were all already taken in C89, it does not matter much what it is.