The authors of the standard didn't invent gets(). It was existing
practice at the time the standard was first developed. I'm not saying
that including it in the standard was a good idea, but dropping it
would not have been easy. And it's finally been deprecated in C99 TC3
(better late than never).
Yeah, one sentence, without adornment, 7.26.9, that reads:
"The gets function is obsolescent, and is deprecated."
How bold.
Earlier they provide all of this, presumably so the Forward reference
can be added.
7.19.7.7 The gets function
Synopsis
1 #include <stdio.h>
char *gets(char *s);
Description
2 The gets function reads characters from the input stream pointed
to by stdin, into the array pointed to by s, until end-of-Þle is
encountered or a new-line character is read. Any new-line
character is discarded, and a null character is written
immediately after the last character read into the array.
Returns
3 The gets function returns s if successful. If end-of-Þle is
encountered and no characters have been read into the array, the
contents of the array remain unchanged and a null pointer is
returned. If a read error occurs during the operation, the array
contents are indeterminate and a null pointer is returned.
Forward references: future library directions (7.26.9).
Note: they didn't mention anything about why not to use it, what
dangers it might have, or even flag it as deprecated in the main
function description. Hardly the flashing warning light it deserves.