scope of malloc

Paul Beusterien paulb at ssd.csd.harris.com
Tue Nov 20 09:50:46 AEST 1990


In article <11631 at alice.att.com> (Andrew Koenig) writes :
> Seriously, though, if one decides to make it impossible to support
> alloca(), as the definition of ANSI C allows, it is sometimes possible
> to produce significantly faster object code as a result.
> 
> For example, barring alloca() means that the compiler can always know
> the size of the stack frame.  That, in turn, means that it is possible
> to maintain the stack using only a single pointer.  That implies that
> a function call need update only one stack register and not two.

Not necessarily.  It may be possible to use one stack pointer all the
time except for routines that use alloca.  In the routines that call
alloca, the performance gains of alloca more than make up for the
overhead of using a second stack pointer for the frame.
--
Paul Beusterien                          paulb at ssd.csd.harris.com
Harris Computer Systems        {uunet,mit-eddie,novavax}!hcx1!paulb
Ft. Lauderdale, FL                     voice: (305) 973 5270



More information about the Comp.lang.c mailing list