Path: utzoo!utgpu!water!watmath!clyde!bellcore!faline!thumper!ulysses!gamma!pyuxp!lcuxb!lcuxa!mike2 From: mike2@lcuxa.UUCP (M S Slomin) Newsgroups: comp.sources.d Subject: Simulation of 'alloca' -- can it be done in TurboC or MSC? Keywords: alloca Message-ID: <203@lcuxa.UUCP> Date: 19 May 88 12:37:27 GMT Organization: Bell Communications Research Lines: 15 Posted: Thu May 19 08:37:27 1988 Quick question: has anyone worked out a way to simulate the 'alloca' function in either TurboC or MSC (DOS for those who don't know)? Alloca is a memory allocation analogue to an automatic variable. Just as an automatic variable exists only while a function is in progress, alloca allocates memory only while a function is in progress, and when the function exits that memory is freed. Obviously, this can be implemented with malloc/free combinations, but the automatic approach seems cleaner, which perhaps explains why many programmers use alloca if it is available. It would be nice to implement this. Thanks for the help. Mike Slomin bellcore!lcuxa!mike2