Douglas A. Gwyn wrote
(in article said:
New code doesn't need to use gets.
But it does. At a scary rate. It is apparent that far too many
of those learning C today are being taught by dinosaurs.
Perhaps a surprise inspection of C instructors world-wide needs
to be held next Tuesday, and anyone that isn't familiar with the
gets() problems would be killed on site. But, I digress...
Recall that gets was
specified in the standard simply because it was a widely
used piece of the base library. Almost any function can
be abused, but that doesn't mean they all need to be
deprecated.
But gets() does. Not only can it be abused, it's almost
impossible to use it in a way that isn't problematic.
Perhaps the reference implementation of gets() -- if for some
unfathomable reason it is not deprecated -- should be the normal
broken, crap behavior, along with the added bonus of a message
output to stderr (if available) along the lines of:
** WARNING: The programmer that wrote this code is lazy,
** poorly trained, and in dire need of a 2x4 up the side of the
** head. If you continue to use this program, despite this
** issue, you need to have your head examined as well.
** Suitable replacement candidates can be recruited from
** comp.lang.c or comp.std.c. Now back to your broken program
** in progress...