🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3704

Re: gets() and getchar

#3704
From: Zefram
Date: Fri, 11 Aug 1995 00:23
26 lines
1587 bytes
 <halasz@caip.rutgers.edu> wrote:
>- 	-Dgets='DONT_USE_GETS!'

That's a disgusting hack.  It might well make the compiler unusable if
an included header includes a prototype for gets(), even if it's not
actually called.  In any case, there's nothing wrong with using gets()
in certain limited cases, even in production code.  In quick test
programs and the like, it's very convenient and not a problem even if
applied directly to text typed by humans.

>- (The quotes are for Unix.)
>
>(The quote-marks gain nothing in anie shell, not even "csh".)

The quote marks help in post-2.6beta4 zsh.

>                                                               It would
>be nicer if "gets" took a length, too.  It is, after all, quite nice to
>hav all theze functions that work on "stdin" with no need to write it.

It hardly any extra typing to add the ",stdin" to the fgets call.  It's
also trivial to define a macro that will do this.  There's no real
advantage to having yet another specialisation of a general stdio
function.

-zefram
Technical Details
Message-ID: <1995Aug11.002333.20047@dcs.warwick.ac.uk>
Path: arc1-ca.pugleaf.net!news.dcs.warwick.ac.uk!not-for-mail
References: <Pine.ULT.3.91.950807194041.19202A-100000@mars> <KANZE.95Aug9103309@slsvhdt.lts.sel.alcatel.de> <40bqih$bft@caip.rutgers.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!news.dcs.warwick.ac.uk!not-for-mail
From: A.Main@dcs.warwick.ac.uk (Zefram)
Subject: Re: gets() and getchar
X-Nntp-Posting-Host: stone
Message-ID: <1995Aug11.002333.20047@dcs.warwick.ac.uk>
Sender: news@dcs.warwick.ac.uk (Network News)
Organization: Department of Computer Science, Warwick University, England
References: <Pine.ULT.3.91.950807194041.19202A-100000@mars> <KANZE.95Aug9103309@slsvhdt.lts.sel.alcatel.de> <40bqih$bft@caip.rutgers.edu>
Date: Fri, 11 Aug 1995 00:23:33 GMT