Article View: comp.std.c
Article #3794Re: gets() and getchar
From: Clive D.W. Feather
Date: Sat, 19 Aug 1995 21:33
Date: Sat, 19 Aug 1995 21:33
25 lines
1764 bytes
1764 bytes
In article <808736493snz@wbriscoe.demon.co.uk>, walter briscoe <walter@wbriscoe.demon.co.uk> wrote: >In article <danpop.808655822@rscernix> Dan.Pop@mail.cern.ch "Dan Pop" writes: >>> cc .... -Dgets=DONT_USE_GETS >> Whether you include <stdio.h> or not is irrelevant. gets() is in the >> implementation namespace, and any attempt to redefine it invokes undefined >> behaviour, whether <stdio.h> is included or not: > I have difficulty with any defence of gets because it allows a program > to have undefined behavior at run time in consequence of an input. I > think that is a standards issue and, in a perfect world, would argue > that gets should be removed from the standard library. Given that, I > appreciate any suggestion which assists me to avoid use of this > abomination in my own code and to excise it from code for which I take > responsibility. You have missed the point. The Standard does not allow you to hide gets in this way, as Dan points out. I agree that gets ought to be removed from the Standard, but that is a different issue. -- Clive D.W. Feather | If you lie to the compiler, clive@demon.net (work, preferred) | it will get its revenge. clive@stdc.demon.co.uk (home) | - Henry Spencer
Technical Details
Message-ID:
<DDKuJq.84t@stdc.demon.co.uk>Path:
arc1-ca.pugleaf.net!stdc.demon.co.uk!cliveReferences:
<Pine.ULT.3.91.950807194041.19202A-100000@mars> <40s0eo$k8c@goanna.cs.rmit.edu.au> <danpop.808655822@rscernix> <808736493snz@wbriscoe.demon.co.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!stdc.demon.co.uk!clive From: clive@stdc.demon.co.uk (Clive D.W. Feather) Newsgroups: comp.std.c Subject: Re: gets() and getchar Date: Sat, 19 Aug 1995 21:33:24 GMT Organization: Demon Internet Limited (personal account) Message-ID: <DDKuJq.84t@stdc.demon.co.uk> References: <Pine.ULT.3.91.950807194041.19202A-100000@mars> <40s0eo$k8c@goanna.cs.rmit.edu.au> <danpop.808655822@rscernix> <808736493snz@wbriscoe.demon.co.uk> X-NNTP-Posting-Host: stdc.demon.co.uk