Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!edcastle!aiai!richard From: richard@aiai.ed.ac.uk (Richard Tobin) Newsgroups: comp.lang.c Subject: Re: scope of malloc Message-ID: <3746@skye.ed.ac.uk> Date: 13 Nov 90 16:36:34 GMT References: <1990Nov07.134942.7355@virtech.uucp> <3739@skye.ed.ac.uk> <4251@goanna.cs.rmit.oz.au> Reply-To: richard@aiai.UUCP (Richard Tobin) Organization: AIAI, University of Edinburgh, Scotland Lines: 22 In article <4251@goanna.cs.rmit.oz.au> ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes: >Any processor that can't implement alloca() as a built-in operation is >going to have a hard time with PL/I, Fortran 90, and Ada, all of which >allow the declaration of local variables whose size is not known until >the declaration is elaborated. The fact that gcc supports alloca() as >well as "auto int foo[some_expr()]" is not a coincidence. alloca() is in fact somewhat more powerful than variable-size locals, since you can do an alloca() anywhere, rather than just at the start of a function - even inside a loop. [Of course, if the variable size of your autos is determined by an arbitrary expression then "not just at the start of a function" means little.] Does this cause additional implementation problems on any architectures? -- Richard -- Richard Tobin, JANET: R.Tobin@uk.ac.ed AI Applications Institute, ARPA: R.Tobin%uk.ac.ed@nsfnet-relay.ac.uk Edinburgh University. UUCP: ...!ukc!ed.ac.uk!R.Tobin