Path: utzoo!attcan!uunet!husc6!think!ames!pasteur!ucbvax!UICVM!U23405 From: U23405@UICVM (Michael J. Steiner) Newsgroups: comp.lang.c Subject: alloca(), #if, and other controversial things... Message-ID: <8808171410.AA05337@ucbvax.Berkeley.EDU> Date: 17 Aug 88 01:51:52 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 22 Note: The following is only my opinion, not a research summary or survey results. :-) In my opinion, I have a slight aversion to using machine-dependent code, including #if's, bit operations, and #asm. I am against using alloca() because malloc() and calloc() are supported by more compilers, easier to support on most machines than alloca(), and because the free()'s that must accompany the use of malloc() or calloc() help to document the code (e.g. remind the programmer of what he will lose when the function terminates). Also, someone's argument that using both malloc() and alloca() may lead to memory conflicts is a good reason to only use malloc() or calloc(). I generally try to do a programming task using the standard (noncontroversial) concepts in C. However, if using #if or alloca() (etc.) is the only way to do a task (or if not using it would make the code less understandable), and your compiler supports it, and you document your usage of these controversial concepts (items?), then I have no complaint. However, most of my programming assignments so far have not been in writing compilers, OS's, or other "hard" software, so I haven't had the need to use these things. Michael Steiner Email: U23405@UICVM