Defect Report #014
  
Submission Date: 10 Dec 92
 
Submittor: WG14
Source: X3J11/90-049 (Max K. Goff)
 
Question 1
  X/Open Reference Number KRT3.159.1
  There are conflicting descriptions of the setjmp()
interface in ISO 9899:1990. In subclause 7.6 on page 118, line 8, it is
stated that ``It is unspecified whether setjmp is a
macro or an identifier declared with external linkage.'' Throughout the
rest of the standard, however, it is referred to as ``the setjmp
macro''; in addition, the rationale document states that setjmp
must be implemented as a macro. Please clarify whether setjmp
must be implemented as a macro, or may be a function as well as a macro,
or may just be a function.
 
Response
  The standard states that setjmp can be either a
macro or a function.  It is referred to as ``the setjmp
macro'' just to avoid longwindedness. The rationale document is
incorrect in saying that it must be a macro.
 
Question 2
  X/Open Reference Number KRT3.159.2
  Subclause 7.9.6.2 The fscanf function states:
  If end-of-file is encountered during input, conversion is
terminated. If end-of-file occurs before any characters matching the
current input directive have been read (other than leading white space,
where permitted), execution of the current directive terminates with
input failure; otherwise, unless execution of the current directive is
terminated with a matching failure, execution of the following directive
(if any) is terminated with an input failure.
  How should an implementation behave when end-of-file
terminates an input stream that satisfies all conversion specifications
that consume input but there is a remaining specification request that
consumes no input (e.g. %n)? Should the
non-input-consuming directive be evaluated or terminated with an input
failure as described above?
 
Correction
 
Add to subclause 7.9.6.2, page 137, line 4 (the n
conversion specifier):
  No argument is converted, but one is consumed. If the conversion
specification with this conversion specifier is not one of %n,
%ln, or %hn, the behavior is
undefined.
 
Add to subclause 7.9.6.2, page 138, another Example:
  In:
 
#include <stdio.h>
 /* ... */
 int d1,
d2, n1, n2, i;
 i = sscanf("123", "%d%n%n%d",&d1, &n1, &n2,
&d2);
 
 the value 123 is assigned to d1 and the
value 3 to n1
. Because %n can never get an input failure the
value of 3 is also assigned to n2. The value of 
d2 is not affe cted. The value 3 is assigned to i.
Previous Defect Report 
< -  > 
Next Defect Report