Defect Report #429
Previous Defect Report < - > Next Defect Report
Submitter: Douglas Walls
Submission Date: 2013-02-11
Source: WG 14
Reference Document: N1673
Version: 1.0
Date: April 2013
Subject: Should gets_s discard next input line when (s == NULL) ?
Summary
gets_s Annex K.3.5.4.1p2 says:
"If there is a runtime-constraint violation, s[0] is set to the
null
character, and characters are read and discarded from stdin until
a
new-line character is read, or end-of-file or a read error
occurs."
The runtime-constraint violation here can be caused by a null
"s"
pointer. Should we discard the next input line even if
(s == NULL) ?
The way it is written, it looks like the answer is yes.
However it is
not clear to us that that was the intent. Note also that s[0]
cannot be
set to the null character when s==NULL.
Suggested Technical Corrigendum
Apr 2013 meeting
Committee Discussion
- The issue is found in Annex K.3.5.4.1p3, not p2.
- The Microsoft implementation appears to treat this as a runtime-constraint violation.
- The Dikumware implementation leaves this behavior unspecified.
Previous Defect Report < - >
Next Defect Report