alloca(), #if, and other controversial things...
Michael J. Steiner
U23405 at UICVM
Wed Aug 17 11:51:52 AEST 1988
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 at UICVM
More information about the Comp.lang.c
mailing list