Newsgroups: alt.folklore.computers Subject: alloca() origins? Organization: None X-Newsreader: trn 4.0-test72 (19 April 1999) From: kragen@dnaco.net (Kragen Sitaker) Lines: 17 Message-ID: X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly X-Complaints-To: support@usenetserver.com NNTP-Posting-Date: Fri, 10 Nov 2000 21:08:26 EST Date: Sat, 11 Nov 2000 02:08:26 GMT Path: chonsp.franklin.ch!pfaff.ethz.ch!news-zh.switch.ch!news-ge.switch.ch!news.tele.dk!63.211.125.72!cyclone2.usenetserver.com!news-out.usenetserver.com!cyclone1.usenetserver.com!e420r-sjo3.usenetserver.com.POSTED!not-for-mail Xref: chonsp.franklin.ch alt.folklore.computers:68139 I was recently astonished to find that the FreeBSD box we have here doesn't have alloca(). I know nobody ever standardized it, but I'd never seen a machine with C but without alloca(). The Linux man page says: There is evidence that the alloca function appeared in 32v, pwb, pwb.2, 3bsd, and 4bsd. There is a man page for it in BSD 4.3. Linux uses the GNU version. I'm curious when alloca() was introduced. Actually, I'm curious when pwb was introduced, too. Surely someone here can tell the tale? -- Kragen Sitaker Perilous to all of us are the devices of an art deeper than we ourselves possess. -- Gandalf the Grey [J.R.R. Tolkien, "Lord of the Rings"] ###### From: jmfbahciv@aol.com Newsgroups: alt.folklore.computers Subject: Re: alloca() origins? Date: Sat, 11 Nov 00 12:49:33 GMT Organization: UltraNet Communications, Inc. Lines: 15 Message-ID: <8ujirv$gnf$3@bob.news.rcn.net> References: <3A0CC059.B292DEB2@bell-labs.com> X-Trace: u4DTK21bkW5V7tIfhwJdsXjcfKMdQKZV3ILAN8gd9P4= X-Complaints-To: abuse@rcn.com NNTP-Posting-Date: 11 Nov 2000 13:50:55 GMT X-Newsreader: News Xpress Version 1.0 Beta #4 Path: chonsp.franklin.ch!pfaff.ethz.ch!news-zh.switch.ch!news-ge.switch.ch!newsfeeds.belnet.be!news.belnet.be!xfer13.netnews.com!netnews.com!feed2.news.rcn.net!feed1.news.rcn.net!rcn!207-172-245-118 Xref: chonsp.franklin.ch alt.folklore.computers:68025 In article <3A0CC059.B292DEB2@bell-labs.com>, Dennis Ritchie wrote: > > >Kragen Sitaker wrote: >It was evidently an Ebola virus that wasn't sufficiently contained. ROTFLMAO. Now that is a good line. /BAH Subtract a hundred and four for e-mail. ###### From: Dennis Ritchie Newsgroups: alt.folklore.computers Subject: Re: alloca() origins? Date: Sat, 11 Nov 2000 03:43:21 +0000 Organization: Bell Labs / Lucent Technologies Lines: 36 Message-ID: <3A0CC059.B292DEB2@bell-labs.com> References: NNTP-Posting-Host: trux.cs.bell-labs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.61 [en] (WinNT; U) X-Accept-Language: en Path: chonsp.franklin.ch!pfaff.ethz.ch!news-zh.switch.ch!news-ge.switch.ch!news.maxwell.syr.edu!wn4feed!worldnet.att.net!207.24.196.41!nntphub.cb.lucent.com!news Xref: chonsp.franklin.ch alt.folklore.computers:67966 Kragen Sitaker wrote: > > I was recently astonished to find that the FreeBSD box we have here > doesn't have alloca(). I know nobody ever standardized it, but I'd > never seen a machine with C but without alloca(). > ... > I'm curious when alloca() was introduced. Actually, I'm curious when > pwb was introduced, too. Surely someone here can tell the tale? > -- Not the whole tale, but some. I think Ken Thompson first made it between 6th and 7th edition research Unix releases (possibly even earlier) but it does not appear in either one. I believe that I extirpated it from the 7th, because a correct implementation causes strain for otherwise plausible implementations of the stack in the C runtime environment. A version (dated Nov 1978) does appear on the 32V tape we have online (which could explain its appearance in BSD), but only its own source and object file are there, not any uses in the code. We don't have a PWB distribution online so I didn't check it. It might well have appeared there as well. A VAX version appeared in SVr2 (dated June 1983); the source is identical to that in 32V. It's in a directory .../cmd/sccs/lib/libPW/vax/alloca.s which suggest a special helper for existing PWB stuff. It was evidently an Ebola virus that wasn't sufficiently contained. Dennis ###### Newsgroups: alt.folklore.computers Subject: Re: alloca() origins? References: X-Newsreader: NN version 6.5.6 (NOV) From: mtpins@visi.com (Michael T Pins) Lines: 48 Message-ID: Date: Mon, 13 Nov 2000 20:32:51 GMT NNTP-Posting-Host: 209.98.98.24 X-Complaints-To: abuse@visi.com X-Trace: ptah.visi.com 974147571 209.98.98.24 (Mon, 13 Nov 2000 14:32:51 CST) NNTP-Posting-Date: Mon, 13 Nov 2000 14:32:51 CST Path: chonsp.franklin.ch!pfaff.ethz.ch!news-zh.switch.ch!news-ge.switch.ch!newsfeeds.belnet.be!news.belnet.be!xfer13.netnews.com!netnews.com!hermes.visi.com!news-out.visi.com!ptah.visi.com!not-for-mail Xref: chonsp.franklin.ch alt.folklore.computers:68288 kragen@dnaco.net (Kragen Sitaker) writes: >I was recently astonished to find that the FreeBSD box we have here >doesn't have alloca(). I know nobody ever standardized it, but I'd >never seen a machine with C but without alloca(). Which version of FreeBSD? It's on my FreeBSD 2.2.8 machine. The man page says: ***** ALLOCA(3) FreeBSD Library Functions Manual ALLOCA(3) NAME alloca - memory allocator SYNOPSIS #include void * alloca(size_t size) DESCRIPTION The alloca() function allocates size bytes of space in the stack frame of the caller. This temporary space is automatically freed on return. RETURN VALUES The alloca() function returns a pointer to the beginning of the allocated space. If the allocation failed, a NULL pointer is returned. SEE ALSO brk(2), calloc(3), getpagesize(3), malloc(3), realloc(3) BUGS The alloca() function is machine dependent; its use is discouraged. 4th Berkeley Distribution June 4, 1993 1 ***** A quick check shows it's still in FreeBSD 4.1 as well. -- ************************************************************************** * Michael T Pins | mtpins@visi.com * * keeper of the nn sources | mtpins@icaen.uiowa.edu * * ftp://ftp.visi.com/users/mtpins | #include * ###### Newsgroups: alt.folklore.computers Subject: Re: alloca() origins? References: X-Newsreader: NN version 6.5.6 (NOV) From: jot@visi.com (J. Otto Tennant) Lines: 39 Message-ID: Date: Tue, 14 Nov 2000 04:38:00 GMT NNTP-Posting-Host: 209.98.98.8 X-Complaints-To: abuse@visi.com X-Trace: ptah.visi.com 974176680 209.98.98.8 (Mon, 13 Nov 2000 22:38:00 CST) NNTP-Posting-Date: Mon, 13 Nov 2000 22:38:00 CST Path: chonsp.franklin.ch!pfaff.ethz.ch!news-zh.switch.ch!news-ge.switch.ch!news.tele.dk!209.98.98.64!hermes.visi.com!news-out.visi.com!ptah.visi.com!not-for-mail Xref: chonsp.franklin.ch alt.folklore.computers:68475 mtpins@visi.com (Michael T Pins) writes: I'm asking a slightly off-topic question, but ... >kragen@dnaco.net (Kragen Sitaker) writes: >>I was recently astonished to find that the FreeBSD box we have here >>doesn't have alloca(). I know nobody ever standardized it, but I'd >>never seen a machine with C but without alloca(). >Which version of FreeBSD? >It's on my FreeBSD 2.2.8 machine. >The man page says: >***** >ALLOCA(3) FreeBSD Library Functions Manual ALLOCA(3) >NAME > alloca - memory allocator [... I delete ...] >BUGS > The alloca() function is machine dependent; its use is discouraged. Is it *really* machine dependent? Someone wrote for Emacs a generalized alloca(). It did not quite work for Cray Research computers. On the other hand, it only took a few hours to extend it for the Cray [XY]-MP, and only a few days for the Cray 2. A stack is a stack. (Of course, I suspect that there might be a memory leak in the face of longjmp() events.) -- J.Otto Tennant jotto@pobox.com Forsan et haec olim meminisse juvabit. Charter Member of the Vast Right Wing Conspiracy ###### Message-ID: <3A11D85F.B5E91CEC@thinkage.ca> From: "Alan T. Bowler" Organization: Thinkage Ltd. X-Mailer: Mozilla 4.5 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: alt.folklore.computers Subject: Re: alloca() origins? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 45 Date: Tue, 14 Nov 2000 19:27:11 -0500 NNTP-Posting-Host: 192.102.11.4 X-Trace: nnrp1.uunet.ca 974248029 192.102.11.4 (Tue, 14 Nov 2000 19:27:09 EST) NNTP-Posting-Date: Tue, 14 Nov 2000 19:27:09 EST Path: chonsp.franklin.ch!pfaff.ethz.ch!news-zh.switch.ch!news.nextra.ch!news1.sunrise.ch!news.imp.ch!sunqbc.risq.qc.ca!news.uunet.ca!nnrp1.uunet.ca.POSTED!not-for-mail Xref: chonsp.franklin.ch alt.folklore.computers:68403 "J. Otto Tennant" wrote: > > mtpins@visi.com (Michael T Pins) writes: > > I'm asking a slightly off-topic question, but ... > > >kragen@dnaco.net (Kragen Sitaker) writes: > > >>I was recently astonished to find that the FreeBSD box we have here > >>doesn't have alloca(). I know nobody ever standardized it, but I'd > >>never seen a machine with C but without alloca(). > > >Which version of FreeBSD? > >It's on my FreeBSD 2.2.8 machine. > >The man page says: > > >***** > > >ALLOCA(3) FreeBSD Library Functions Manual ALLOCA(3) > > >NAME > > alloca - memory allocator > > [... I delete ...] > > >BUGS > > The alloca() function is machine dependent; its use is discouraged. > > Is it *really* machine dependent? Someone wrote for Emacs a generalized > alloca(). It did not quite work for Cray Research computers. On the > other hand, it only took a few hours to extend it for the Cray [XY]-MP, > and only a few days for the Cray 2. > > A stack is a stack. > > (Of course, I suspect that there might be a memory leak in the face of > longjmp() events.) Yes it is quite machine dependant. A "stack" is a concept, and there are a number of ways of that the logical stack(s) call/return and activation frames can be implemented. What is "best" will depend on the underlying architecture (both software and hardware). alloca() may not fit with some implementations, and it may have a high overhead in others. ###### From: jepler.lnk@lnk.ispi.net (jepler epler) Newsgroups: alt.folklore.computers,comp.std.c Subject: Re: alloca() origins? References: Followup-To: comp.std.c Message-ID: User-Agent: slrn/0.9.5.7 (UNIX) Lines: 20 Date: Wed, 15 Nov 2000 01:00:06 GMT NNTP-Posting-Host: 209.50.4.137 X-Trace: newsfeed.slurp.net 974250006 209.50.4.137 (Tue, 14 Nov 2000 19:00:06 CDT) NNTP-Posting-Date: Tue, 14 Nov 2000 19:00:06 CDT Path: chonsp.franklin.ch!pfaff.ethz.ch!news-zh.switch.ch!machtgarnix.switch.ch!news-ge.switch.ch!news.maxwell.syr.edu!newsfeed.slurp.net!jepler.lnk Xref: chonsp.franklin.ch alt.folklore.computers:68625 On Tue, 14 Nov 2000 04:38:00 GMT, J. Otto Tennant wrote: >Is it *really* machine dependent? Someone wrote for Emacs a generalized >alloca(). It did not quite work for Cray Research computers. On the >other hand, it only took a few hours to extend it for the Cray [XY]-MP, >and only a few days for the Cray 2. > >A stack is a stack. What stack? There's been a recent comp.std.c thread suggesting that such limits as recursion limits are implementation-defined. Why not implement C so that there is static storage for each function's auto variables, and prohibit recursion altogether? (The "It has curly braces, so it must be C-like" quakec did something like this) Sure, there's a limit of 0 recursions, and threading this program will be a bitch, but I don't believe that is prohibited by the standard. Jeff