Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2004:
[Freeciv-Dev] Re: (PR#2521) general effects framework
Home

[Freeciv-Dev] Re: (PR#2521) general effects framework

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: kaufman@xxxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2521) general effects framework
From: "rwetmore@xxxxxxxxxxxx" <rwetmore@xxxxxxxxxxxx>
Date: Mon, 15 Mar 2004 07:38:35 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=2521 >


Huh?

If the macro codes a replacement variable pcity, that would cause a
lot of problems if someone accidently dropped a variable declaration
or other scoping tweak that normally overrode it or the like.

It also leads to confusion when trying to actually use a local variable
in iterator like context, i.e. not self-contained macro but one with
several parts. Making this have the same style is just better coding
so no one needs to think twice about what is local the macro and what
is not depending on whether the macro is currently self-contained or not.

The rule ... Anything used totally within the macro context should use
internal not external naming conventions. Anything with an underbar is
*not* then legally visible/usable by the programmer outside of the macro.

Cheers,
RossW
=====

Jason Short wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=2521 >
> 
>>[kauf - Mon Mar 08 02:34:48 2004]:
>>
>>here are new versions (v7) of the general effects patches. 
> 
> 
> In a lot of places you define iterators like:
> 
>   #define improvement_effects_iterate(_pcity, _id, _type, _eff)        
>        \
> 
> there's no reason to use _ for the variables here.  Just give them
> normal names.  These identifiers are local to the macro so there's no
> need for namespace worries.
> 
> jason





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