Defect Report #058
Submission Date: 07 Jun 93
Submittor: Project Editor (P.J. Plauger)
Source: Fred Tydeman
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
Parts of the the C Standard that may help answer the question follow.
Subclause 188.8.131.52The fprintf function, page 134, lines 16-18:
- something else
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 fscanf.
Subclause 184.108.40.206 Translation limits, page 13, line 17:
- 509 characters in a logical source line
But, note, there is no execution limit. Subclause 220.127.116.11 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 (including terminator). 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?
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, other than on the size
Previous Defect Report
< - >
Next Defect Report