retiring gets(3)

Alan T. Bowler [SDG] atbowler at watmath.waterloo.edu
Sat Nov 26 09:17:35 AEST 1988


In article <1988Nov8.054845.23998 at utstat.uucp> geoff at utstat.uucp (Geoff Collyer) writes:
>Let your vendor know that you want to see gets deleted from its next
>release, delete gets.o from your C library, move gets.o to -lgets,
>define gets(s) as "gets is unsafe; use fgets(3)"<><><> in your stdio.h;
>do whatever you can to help.
>
>If your vendor protests your reasonable request, point out that gets,
>as part of stdio, is a decade-old backward compatibility hack for
>compatibility with the Sixth Edition UNIX Portable I/O Library, which
>was utterly replaced by stdio no later than 1979.  Accept no excuses;
>converting programs from using gets to fgets is largely mechanical,
>and stripping trailing newlines is trivial to code yourself.
>
While the vendor may sympathize with the reasoning, the mechanics
of the the US Federal bureaucracy work against this.  As long as
gets() is in the an official ANSI standard, it will be in a the validation
suites.  Part of the boiler plate used in sales contracts to the
the US government is that the compiler must be an officially
validated compiler (lawyers an accountants don't care about
the dangers of GETS/FGETS just that it be "certified").  In other
words once the ANSI standard gets passed and someone gets themselves
declared and official certifier, you can't sell your compiler to
a US Federal department without such certification.  That is a
lot of revenue for a vendor to give up to satisfy your request.



More information about the Comp.lang.c mailing list