Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2004:
[Freeciv-Dev] Re: Freeciv commit: ali: Add macro is_city_hilited().
Home

[Freeciv-Dev] Re: Freeciv commit: ali: Add macro is_city_hilited().

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Arnstein Lindgard <a-l@xxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Freeciv commit: ali: Add macro is_city_hilited().
From: Raimar Falke <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Mon, 5 Jan 2004 00:48:41 +0100

On Sun, Jan 04, 2004 at 11:48:19AM +0100, Arnstein Lindgard wrote:
> On Sun, 4 Jan 2004 11:30:36 +0100 Raimar Falke wrote:
> 
> > > +#define is_city_hilited(pcity)                                           
> > >    \
> > > +  (map_get_tile((pcity)->x, (pcity)->y)->client.hilite == HILITE_CITY)   
> > >    \
> > > +
> > 
> > It was my error to not report earlier but such macros should really be
> > functions.
> 
> Ok I'll change it. Can you explain the criteria for macros?

Everything which can be written as a function should be written as a
function. The iterates are the main examples for macros which can't be
written as functions.

In the past macros were used for speed reasons. The maintainers
decided recently that inlining should be used in such cases. Your
macros is clearly not speed critical.

At least I consider the current functional macros a legacy which
should be converted to inline function. However other maintainers
disagreed on this point.

So at least for new macros the rules are quite clear:
 - non-function -> macro
 - speed critical -> inline function
 - else use a normal function

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "I haven't lost my mind - it's backed up on tape somewhere."


[Prev in Thread] Current Thread [Next in Thread]