Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2004:
[Freeciv-Dev] Re: (PR#7195) inlining map_pos_to_index
Home

[Freeciv-Dev] Re: (PR#7195) inlining map_pos_to_index

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jshort@xxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7195) inlining map_pos_to_index
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 15 Jan 2004 17:58:13 -0800
Reply-to: rt@xxxxxxxxxxx

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

Ross Wetmore wrote:

> 1)  Use local variables. Assiging globals to local variables at the start
>     of a code block and then using only the local variables within the
>     block lets the compiler know they are not subject to change except if
>     done explicitly in the code block.

Using local variables _is_ the greatest thing in the world.  (Except for 
a nice MLT - mutton, lettuce, and tomato sandwich.  When the mutton is 
nice and lean and the tomato is ripe, they're so perky.  I love that.)

But we can't use local variables in a function-like macro that returns a 
value.  So our only alternatives are

(1) Do extra calculation rather than store the temporary values.  This 
is what the macro form in CVS did, and it's definitely slower.

(2) Use global variables.  This is what your corecleanups patch does. 
But then the caller has to worry about sequence points and lots of them 
have to be rewritten.  No good.

jason




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