🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #13433

Re: Memory allocation

#13433
From: Thomson
Date: Fri, 12 Jan 1990 04:50
14 lines
1046 bytes
Regarding the problem of stack usage with recursive functions, note that it
is possible to use static allocation of data structures with recursive 
functions, as long as the usage of the data structure does not span a recur-
sive call.

In the copyfile() example under consideration, it would appear to be safe to
allocate buff[ ... ] outside the function.  This would solve your stack 
overflow problems without any major code changes.

Duncan Thomson

P.S. I think the best book for learning C programming, on the Amiga as
well as on any other system, is the Kernighan and Ritchie classic, "The
C Programming Language."
Technical Details
Message-ID: <88515@linus.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!spdcc!merk!alliant!linus!mbunix!duncant

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!spdcc!merk!alliant!linus!mbunix!duncant
From: duncant@mbunix.mitre.org (Thomson)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Memory allocation
Keywords: stack size, heap, Lattice 5.04
Message-ID: <88515@linus.UUCP>
Date: 12 Jan 90 04:50:54 GMT
Sender: news@linus.UUCP
Reply-To: duncant@mbunix.mitre.org (Thomson)
Organization: The MITRE Corp. Bedford, MA
Lines: 14