Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 5/3/83; site nsc.uucp
Path: utzoo!linus!philabs!seismo!hao!menlo70!nsc!glenn
From: glenn@nsc.UUCP
Newsgroups: net.unix-wizards
Subject: Re: stack memory allocation
Message-ID: <333@nsc.uucp>
Date: Wed, 20-Jul-83 12:56:38 EDT
Article-I.D.: nsc.333
Posted: Wed Jul 20 12:56:38 1983
Date-Received: Thu, 21-Jul-83 21:42:27 EDT
References: <2404@uiucdcs.UUCP> <295@gatech.UUCP>, <391@ariel.UUCP>
Organization: National Semiconductor, Sunnyvale
Lines: 18

If you are interested in portability, _don't_ use alloca.  Some
architectures make assumptions about how routine stack frames are
laid out that make it impossible to port this routine.

I ran across this problem when porting SCCS to our NS16000-based
system.  When I first bumped into alloca, I thought it was a neat
idea.  Then I tried to port it and discovered that, no matter how
I tried playing with the stack and frame pointers, there was no way
to maintain stack frame integrity so that subsequent function calls
would work.  I ended up replacing invocations of alloca with malloc/
free pairs.

BTW: don't blame this routine on Berkeley.  It shows up on USG systems
as part of libPW.a, almost certainly predating its appearances on
Berkeley systems.

		-- Glenn Skinner
		...!{fortune,menlo70}!nsc!glenn