[Freeciv-Dev] Re: (PR#7279) Macro optimizations
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=7279 >
On Wed, Jan 21, 2004 at 09:24:46AM -0800, Arnstein Lindgard wrote:
> > Use of alloca() to create temporary stack space is a potential
> > compatibility issue, but can be removed by making preallocation
> > of local storage in env a requirement or part of the definition
> > macro rather than option.
> Assuming we need local variables:
>
> My linux man pages says alloca() is non POSIX and it's use is
> discouraged. Some existing Freeciv code (which looks imported)
> substitutes alloca() with malloc() if you don't have a requirement,
> and that introduces overhead for one function call in your macro.
Indeed. alloca is forbidden in freeciv. Note that C99 provides a
portable replacement: variable sized arrays. So
int f(int n)
{
char *p=alloca(n);
becomes
int f(int n)
{
char p[n];
But I have the feeling that this doesn't help here.
> bool normalize_map_pos(int *x, int *y) would become
> normalize_map_pos(ENV, X, Y)
I'm sure that this won't happen.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"We just typed make..."
-- Stephen Lambrigh, Director of Server Product Marketing at Informix,
about porting their Database to Linux
- [Freeciv-Dev] Re: (PR#7279) Macro optimizations, (continued)
- [Freeciv-Dev] Re: (PR#7279) Macro optimizations, rwetmore@xxxxxxxxxxxx, 2004/01/20
- [Freeciv-Dev] Re: (PR#7279) Macro optimizations, rwetmore@xxxxxxxxxxxx, 2004/01/20
- [Freeciv-Dev] Re: (PR#7279) Macro optimizations, Jason Short, 2004/01/20
- [Freeciv-Dev] Re: (PR#7279) Macro optimizations, Per I. Mathisen, 2004/01/21
- [Freeciv-Dev] Re: (PR#7279) Macro optimizations, Raimar Falke, 2004/01/21
- [Freeciv-Dev] Re: (PR#7279) Macro optimizations, Arnstein Lindgard, 2004/01/21
- [Freeciv-Dev] Re: (PR#7279) Macro optimizations, rwetmore@xxxxxxxxxxxx, 2004/01/21
- [Freeciv-Dev] Re: (PR#7279) Macro optimizations, Arnstein Lindgard, 2004/01/21
- [Freeciv-Dev] Re: (PR#7279) Macro optimizations, Arnstein Lindgard, 2004/01/21
- [Freeciv-Dev] Re: (PR#7279) Macro optimizations, Raimar Falke, 2004/01/21
- [Freeciv-Dev] Re: (PR#7279) Macro optimizations,
Raimar Falke <=
- [Freeciv-Dev] Re: (PR#7279) Macro optimizations, Jason Short, 2004/01/21
- [Freeciv-Dev] Re: (PR#7279) Macro optimizations, rwetmore@xxxxxxxxxxxx, 2004/01/21
- [Freeciv-Dev] Re: (PR#7279) Macro optimizations, rwetmore@xxxxxxxxxxxx, 2004/01/21
- [Freeciv-Dev] Re: (PR#7279) Macro optimizations, rwetmore@xxxxxxxxxxxx, 2004/01/21
- [Freeciv-Dev] Re: (PR#7279) Macro optimizations, Jason Short, 2004/01/22
- [Freeciv-Dev] Re: (PR#7279) Macro optimizations, Jason Short, 2004/01/22
- [Freeciv-Dev] Re: (PR#7279) Macro optimizations, Arnstein Lindgard, 2004/01/22
- [Freeciv-Dev] Re: (PR#7279) Macro optimizations, rwetmore@xxxxxxxxxxxx, 2004/01/23
- [Freeciv-Dev] Re: (PR#7279) Macro optimizations, Arnstein Lindgard, 2004/01/25
- [Freeciv-Dev] Re: (PR#7279) Inline/Macro optimizations, Arnstein Lindgard, 2004/01/25
|
|