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: "Per I. Mathisen" <per@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Freeciv commit: ali: Add macro is_city_hilited().
From: Ross Wetmore <rwetmore@xxxxxxxxxxxx>
Date: Sun, 04 Jan 2004 09:57:02 -0500


The current status of the inline function vs macro discussion and rules
are that macros are the accepted and correct way to handle simple cases.
For more complex ones one should use a full functional implementation.
Inline raises issues with both compatibility support and value (since
it is an optional vs fixed directive to the compiler) and thus should
never be used in Freeciv code.

If Raimar wants this trivial macro to be coded as a function, he should
probably do the test comparisons to see how much of a performance impact
this raises.

IMHO, this is exactly the sort of trivial expression that macros are
designed to implement in a way that can be easily maintained and
understood. Changing this to a function is not yet needed to deal with
any complexity issues.

Cheers,
RossW
=====

Per I. Mathisen wrote:
On Sun, 4 Jan 2004, 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.


Maybe someone should commit jason's inline patch.  Uh, Jason did write an
inline patch, right?

  - Per



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