Request for Interpretations

Fred Tydeman uunet!ibmpa.awdpa.ibm.com!tydeman
Tue Aug 3 07:19:14 PDT 1993


Subject: NCEG Request For Interpretations
 
At the May NCEG meeting, two C language interpretation questions arose:
  1) Must there be an integer type for each pointer type?
     This was in connection with 64-bit long long extensions.
  2) What size number must scanf family process?
     This was in connection floating-point extensions.
 
I submitted them, via Tom Plum, for official interpretations.  They were
processed at the ISO C meeting just recently finished in London. Tom has
sent unofficial copies of the responses that will be very close to the
final official copy.
 
---------------------------------------------------------------------
 
Defect Report #057
 
Submission Date: 07 Jun 93
 
Submittor: Project Editor (P.J. Plauger)
 
Source: Fred Tydeman
 
 = Question 1
 
Must there exist a user-accessible integral type for every pointer?
If an implementation provides 48-bit pointers, must there be an integral
type, such as long or int, that is at least 48-bits?
 
Parts of the C Standard that may help answer the question follow:
 
Subclause 6.3.4, Cast operators, page 45, lines 30-34 and Footnote
45:
 
A pointer may be converted to an integral type. The size of
integer required and the result are implementation-defined. If the
space provided is not long enough, the behavior is undefined.
 
An arbitrary integer may be converted to a pointer. The result
is implementation-defined.(45) [Footnote: The mapping functions for
converting a pointer to an integer or an integer to a pointer are
intended to be consistent with the addressing structure of the execution
environment.
 
Response
 
Integral types and pointer types are incommensurate. An implementation
need not provide an integral type that can accept the conversion from
a pointer type without loss of information.
 
---------------------------------------------------------------------
 
Defect Report #058
 
Submission Date: 07 Jun 93
 
Submittor: Project Editor (P.J. Plauger)
 
Source: Fred Tydeman
 
 = Question 1
 
What is the minimum value for the maximum number of digits in a number
that can be processed by the scanf family and the strtod family?
 
1) 509
 
2) 32767
 
3) something else
 
Parts of the C Standard that may help answer the question follow.
 
Subclause 7.9.6.1,The fprintf function, page 131, lines 16-18:
 
Environmental limit. The minimum value for the maximum
number of characters produced by any single conversion shall be 509.
 
But, note, there is no such environmental limit for scanf.
 
Subclause 5.2.4.1, Translation limits, page 13, line 17:
 
509 characters in a logical source line
 
But, note, there is no execution limit.
 
Subclause 5.2.4.1, Translation Limits, page 13, line 19:
 
32767 bytes in an object (in a hosted environment only)
 
Consider the number 1.0 written as .00000...00001e32759
that is 32767 characters long. There is only one significant digit,
the 1. It can be stored in an array of 32767 characters, so
it should be possible to pass this string to atof, strtod,
or sscanf and get the value 1.0. Correct?
 
Response
 
You are correct, the C Standard imposes no execution limit on the
maximum number of digits in the subject sequence of fscanf
conversion specifiers and the strto* functions.
However the length of a character string object is subject to the
translation limit that you cite.
 
-----
Fred Tydeman, IBM, Austin, Texas (512) 838-3322; fax (512) 838-3484
AIX S/6000 Math library architect & IBM's rep to NCEG (X3J11.1)
Internet: tydemanaibmpa.awdpa.ibm.com    uucp: uunet!ibmsupt!tydeman



More information about the Numeric-interest mailing list