nanogui: alloca()


Previous by date: 11 Oct 2000 18:42:07 -0000 Re: Problem with keys ..., Ritesh Saigal
Next by date: 11 Oct 2000 18:42:07 -0000 Re: Microwindows on MPC823, Greg Haerr
Previous in thread: 11 Oct 2000 18:42:07 -0000 Re: alloca(), Greg Haerr
Next in thread:

Subject: Re: alloca()
From: Brent Thompson ####@####.####
Date: 11 Oct 2000 18:42:07 -0000
Message-Id: <39E4B389.5040806@nlc.com>

Greg Haerr wrote:

> : Is this replacement something that could be rolled into the
> : general release in order to make Microwindows more portable
> : to new platforms?
> 
> Send me the changes.  I suppose we should include 
> malloc/free instead of alloca, since too few systems 
> implement it.  However, alloca is way faster than malloc,
> so I'll look at how it's used and perhaps save this for
> the day Microwindows has a ./configure setup.

Agreed.  What would you think about macro-izing this?
Say:

#ifdef USE_ALLOCA
#define  ALLOCA(size)   alloca(size)
#define  FREEA(pmem)
#else /* no alloca(), so use malloc()/free() instead */
#define  ALLOCA(size)   malloc(size)
#define  FREEA(pmem) free(pmem)
#endif

Then always use ALLOCA() & FREEA() properly so that
malloc()/free() works.  But if there is an alloca()
available, define USE_ALLOCA and all is faster! :-)

BAT
-- 
Brent A. Thompson, Next Level Communications <www.nlc.com>
1776 22nd Street #100, West Des Moines, IA 50266-1444
EMail: ####@####.#### Phone: (515)991-3853


Previous by date: 11 Oct 2000 18:42:07 -0000 Re: Problem with keys ..., Ritesh Saigal
Next by date: 11 Oct 2000 18:42:07 -0000 Re: Microwindows on MPC823, Greg Haerr
Previous in thread: 11 Oct 2000 18:42:07 -0000 Re: alloca(), Greg Haerr
Next in thread:


Powered by ezmlm-browse 0.20.