Path: utzoo!attcan!uunet!husc6!necntc!ames!oliveb!sun!thetone!swilson From: swilson%thetone@Sun.COM (Scott Wilson) Newsgroups: comp.lang.c Subject: Re: alloca wars Message-ID: <63153@sun.uucp> Date: 6 Aug 88 01:37:04 GMT References: <62721@sun.uucp> <394@mfgfoc.UUCP> Sender: news@sun.uucp Reply-To: swilson@sun.UUCP (Scott Wilson) Organization: Sun Microsystems, Mountain View Lines: 38 In article <394@mfgfoc.UUCP> exodus@mfgfoc.UUCP (Greg Onufer) writes: >On a M68k with a decent OS, alloca is not more than a few lines of assembly >code, correct? (Judging by the size of the GNU assembly alloca)... >If one needs alloca and it is not available, why not write a quick alloca? This makes about as much sense as saying: If your in Tokyo and need to get to the airport just ask directions. It's only one sentence, how hard can that be? Well if you don't know the language it's probably pretty damn hard. I would guess the same is true about writing m68k code, if you don't know how it doesn't matter if it is just a few lines. Ok, so I need to write alloca, so let's see I brush up on m68k, buy the book if necessary, understand the calling convention and stack frame stuff for my compiler, figure out if my programming environment has an easy way to get assembler in, understand the particular enviroment's assembler syntax, etc. Gee that should only take 10-15 minutes. We're talking about C here, I think it's unreasonable to expect a programmer to have any knowledge of assembly code to port a program. What may seem like a simple exercise to you and others may be a major chore for me and others. And after all the debate on here about alloca implementation difficulties, I would be hesitant to try it on a cpu that it hasn't already been done for in fear that it be impossible. And what if I'm not running on a 68k? C runs under many OS's and many cpu's some you've never heard of. I've written C code for a TP1 running MOST, how do I do alloca there? The best assembler manual for it is in Japanese. It took me quite a while to write setjmp/longjmp for this beast, it would be just as much of a hassle to write alloca. Isn't that what languages like C are all about, so I don't have to know assembly language? Again let me say that this whole discussion started with regard to portability. Your solution is to add machine dependent code to a program to make it work. So how does that help future portability? It doesn't of course. -- Scott Wilson arpa: swilson@sun.com Sun Microsystems uucp: ...!sun!swilson Mt. View, CA