retiring gets(3)
Rahul Dhesi
dhesi at bsu-cs.UUCP
Wed Nov 16 02:12:23 AEST 1988
In article <1988Nov14.220842.3980 at utstat.uucp> geoff at utstat.uucp (Geoff
Collyer) writes:
>gets is
>probably unique among C library functions because it cannot be used
>safely, no matter how hard you wish or how hard you work.
Well, now, suppose we (a) write lines of known length to a file that is
not writable by anybody else, (b) open that file for input and make it
our standard input and (c) use gets with a buffer that is known to be
big enough to hold any line in that file.
Thus gets is probably unique among C library functions because it can
be used safely if you try hard enough, but it should not be used
anyway, because most practical uses of it are not safe.
--
Rahul Dhesi UUCP: <backbones>!{iuvax,pur-ee}!bsu-cs!dhesi
More information about the Comp.lang.c
mailing list