*BSD News Article 34304


Return to BSD News archive

Xref: sserve comp.os.386bsd.questions:12345 comp.os.386bsd.development:2382 comp.os.386bsd.misc:3192
Newsgroups: comp.os.386bsd.questions,comp.os.386bsd.development,comp.os.386bsd.misc
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!constellation!news.uoknor.edu!ns1.nodak.edu!netnews.nwnet.net!pnl-oracle!osi-east2.es.net!lll-winken.llnl.gov!ames!agate!doc.ic.ac.uk!uknet!festival!edcogsci!richard
From: richard@cogsci.ed.ac.uk (Richard Tobin)
Subject: Re: Why does FreeBSD 1.1.5 say gets() is unsafe?
Message-ID: <CuDGIo.Jn6@cogsci.ed.ac.uk>
Organization: HCRC, University of Edinburgh
References: <311m2e$o33@agate.berkeley.edu> <324v1b$14g@boavista.bln.sub.org> <1994Aug10.151130.1017@rhodes>
Date: Thu, 11 Aug 1994 13:08:47 GMT
Lines: 24

In article <1994Aug10.151130.1017@rhodes> stuart@zen.mathcs.rhodes.edu (Brian L. Stuart) writes:
>At the risk of picking an excessively fine nit (and mixing my metaphors),
>a good argument can be made for doubling the size of the array rather
>than adding a fixed amount.
...
>It is true that doubling will lead to waste bounded by n
>whereas adding a fixed amount bounds the waste by the increment.

You can of course reduce the waste by increasing the space by, say,
20% each time instead of doubling.  This will waste at most 20% of the
required space and still be much faster than adding a constant amount
in the cases where it matters.

>It seems to be the classic time vs. space tradeoff.

Right, and the tradeoff allows plenty of points between the two you
mention.

-- Richard
-- 
Richard Tobin, HCRC, Edinburgh University                 R.Tobin@ed.ac.uk

Ooooh!  I didn't know we had a king.  I thought we were an
autonomous collective.