[comp.sys.sun] Alloca Implementation

mjk@puffed.rice.edu (Mark J. Kilgard) (09/24/89)

The header for alloca, ie. /usr/lib/alloca.h reads as follows:

/*      @(#)alloca.h    1.3     88/02/07        SMI     */
#if defined(sparc)
# define alloca(x) __builtin_alloca(x)
#endif

Why?

It seems very strange to me that alloca is implemented this way.  Is Sun
just trying to be annoying, or is there a purpose.  alloca is in libc.a on
a Sun3.  In libc.a, alloca is no where to be found.  But __builtin_alloca
is.  

I had thought maybe alloca was implemented inline on a Sparc and maybe
this was a some kind of justification but that doesn't seem to be the
case.

  Mark Kilgard
  Rice University
  <mjk@rice.edu>

david@wubios.wustl.edu (David J. Camp) (09/28/89)

In article <1634@brazos.Rice.edu> mjk@puffed.rice.edu (Mark J. Kilgard) writes:
:X-Sun-Spots-Digest: Volume 8, Issue 131, message 7 of 11
:
:The header for alloca, ie. /usr/lib/alloca.h reads as follows:
:
:/*      @(#)alloca.h    1.3     88/02/07        SMI     */
:#if defined(sparc)
:# define alloca(x) __builtin_alloca(x)
  ^
Note that you must delete this space character for it to work!  -David-

Bitnet:   david@wubios.wustl                ^      Mr. David J. Camp
Internet: david%wubios@wucs1.wustl.edu    < * >    Box 8067, Biostatistics
uucp:     uunet!wucs1!wubios!david          v      660 South Euclid
Washington University (314) 36-23635               Saint Louis, MO 63110

ehrlich@cs.psu.edu (Daniel Ehrlich) (10/05/89)

In article <1841@brazos.Rice.edu> david@wubios.wustl.edu (David J. Camp) writes:

   In article <1634@brazos.Rice.edu> mjk@puffed.rice.edu (Mark J. Kilgard) writes:
   :X-Sun-Spots-Digest: Volume 8, Issue 131, message 7 of 11
   :
   :The header for alloca, ie. /usr/lib/alloca.h reads as follows:
   :
   :/*      @(#)alloca.h    1.3     88/02/07        SMI     */
   :#if defined(sparc)
   :# define alloca(x) __builtin_alloca(x)
     ^
   Note that you must delete this space character for it to work!  -David-

I don't think so.  The C preprocessor should still works with any amount
of white space between the `#' and the preprocessor command.

Dan Ehrlich <ehrlich@cs.psu.edu>   | "A message is not a message until the
The Pennsylvania State University  | rules for interpreting it are in the
Department of Computer Science     | hands of the reciever."
University Park, PA   16802        |    --Apollo Belvedere Smith