🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3751

Re: gets() and getchar

#3751
From: Richard A. O'Keefe
Date: Wed, 16 Aug 1995 05:41
25 lines
1712 bytes
I mentioned
    cc .... -Dgets=DONT_USE_GETS

kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763) writes:
>An excellent idea.  But wouldn't it be better if it gave the error
>message at compile time (with a line number so you could find and
>correct it easily)?  Say:

>	-Dgets='DONT_USE_GETS!'

No.  Reason:  a program that _doesn't_ use gets() may still #include <stdio.h>
in order to correctly use fgets().  With your suggestion the prototype for
gets() in <stdio.h> -- assuming of course a C implementation which uses text
files for stdio.h, I know it needn't -- would be in error.

Note that the definition is OUTSIDE the C sources.  It is not something that
I would dream of including in C code that is supposed to be portable, because
if you #include <stdio.h> you aren't supposed to mess with reserved names like
gets.  This is done _outside_ the C code _for debugging_ only on systems where
it is known (by experiment) to work.

-- 
"conventional orthography is ... a near optimal system for the
 lexical representation of English words." Chomsky & Halle, S.P.E.
Richard A. O'Keefe; http://www.cs.rmit.edu.au/~ok; RMIT Comp.Sci.
Technical Details
Message-ID: <40s0eo$k8c@goanna.cs.rmit.edu.au>
Path: arc1-ca.pugleaf.net!goanna.cs.rmit.edu.au!not-for-mail
References: <Pine.ULT.3.91.950807194041.19202A-100000@mars> <409hdq$ib2@goanna.cs.rmit.edu.au> <KANZE.95Aug9103309@slsvhdt.lts.sel.alcatel.de>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!goanna.cs.rmit.edu.au!not-for-mail
From: ok@goanna.cs.rmit.edu.au (Richard A. O'Keefe)
Newsgroups: comp.std.c
Subject: Re: gets() and getchar
Date: 16 Aug 1995 15:41:44 +1000
Organization: Comp Sci, RMIT, Melbourne, Australia
Message-ID: <40s0eo$k8c@goanna.cs.rmit.edu.au>
References: <Pine.ULT.3.91.950807194041.19202A-100000@mars>  <409hdq$ib2@goanna.cs.rmit.edu.au> <KANZE.95Aug9103309@slsvhdt.lts.sel.alcatel.de>
NNTP-Posting-Host: goanna.cs.rmit.edu.au
NNTP-Posting-User: ok
X-Newsreader: NN version 6.5.0 #0 (NOV)