Path: utzoo!attcan!uunet!mcsun!unido!opal!net From: net@opal.cs.tu-berlin.de (Oliver Laumann) Newsgroups: comp.lang.c Subject: Re: alloca() portability Keywords: portability, alloca Message-ID: <2183@kraftbus.opal.cs.tu-berlin.de> Date: 10 Nov 90 16:31:31 GMT References: <14377@smoke.brl.mil> <9122@ncar.ucar.edu> <27537@mimsy.umd.edu> <1990Nov09.233527.7489@chinet.chi.il.us> Reply-To: net@tubopal.UUCP (Oliver Laumann) Organization: Technical University of Berlin, Germany Lines: 19 In article <1990Nov09.233527.7489@chinet.chi.il.us> les@chinet.chi.il.us (Leslie Mikesell) writes: > The usual "simple" way goes something like this: > > #define BIG_BUFF 1024 /* that should be big enough */ > > work(str) > char *str; > { > buffer[BIG_BUFF); > strcpy(buffer,str); /* make a local copy to manipulate */ This, of course, doesn't work when the amount of data to be stored in the local buffer can't be determined at compile time. If it were known at compile time, there would be no need to use alloca() in the first place. -- Oliver Laumann net@TUB.BITNET net@tub.cs.tu-berlin.de net@tub.UUCP