home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: chang.unx.sas.com!walker
- From: walker@chang.unx.sas.com (Doug Walker)
- Subject: Re: alloca() on Amiga?
- Sender: news@unx.sas.com (Noter of Newsworthy Events)
- Message-ID: <Dq26qw.6LB@unx.sas.com>
- Date: Thu, 18 Apr 1996 12:59:20 GMT
- X-Nntp-Posting-Host: chang.unx.sas.com
- References: <2720tdg60.alamito@marketgraph.xs4all.nl> <DpE7Ip.7or@unx.sas.com> <393brdv60.alamito@marketgraph.xs4all.nl> <4l59du$bdo@enterprise.netserv.chula.ac.th>
- Organization: SAS Institute Inc.
-
- In article <4l59du$bdo@enterprise.netserv.chula.ac.th>,
- Soravut Kruavit <u3642295@chula.edu> wrote:
- >Ruud van Gaal (rvg@marketgraph.xs4all.nl) wrote:
- >kkl;
- >: In <DpE7Ip.7or@unx.sas.com> walker@chang.unx.sas.com (Doug Walker)
- >wrote: : >In article <4k1oce$lub@blackice.winternet.com>,
- >: >Anthony Pang <apang@winternet.com> wrote:
- >: >>In article <2720tdg60.alamito@marketgraph.xs4all.nl>,
- >: >>Ruud van Gaal <rvg@marketgraph.xs4all.nl> wrote:
- >: >>>Is there a nice way to get a working alloca() function for the Amiga?
- >: >>>It is present on all PC and Unix C implementations, but not on the Amiga.
- >: >>>(it allocates mem from the stack, automatically freeing it upon return
- >: from
- >: >>>subroutine).
- >: >>
- >: >>GCC and SAS have alloca(). I think DICE has it too.
- >: >
- >: >This is not correct. SAS/C does not supply an alloca() function.
- >: >Third parties may have been able to implement one, but it's not
- >: >a trivial operation.
- >:
- >: Indeed, SAS doesn't have one, but I've received source code for an
- >: implementation which does not free memory upon function exit (would be very
- >: tricky), but somewhere at a later point (garbage collection). It's not really
- >: the ideal thing, but it's close (enough for now).
- >: Thanks for all the replies!
-
- This approach would definately work. You could even improve it by using the
- PROFILE option and writing "profile functions" that get run when each function
- is entered and exited. The enter function would be a dummy function, and the
- exit function would do your garbage collection. For information on writing
- profile functions, see the manual or the source code to the SPROF profiler
- in the SC:EXTRAS directory.
-
- This is still not a complete alloca() implementation because it doesn't deal
- with setjmp/longjmp and you can't alloca() from functions not compiled with
- the PROFILE option.
-
- --
- *****
- *|_o_o|\\ Doug Walker walker@unx.sas.com
- *|. o.| ||
- | o |// Any opinions are mine, not those of
- ====== SouthPeak Interactive
-