Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Re: [PATCH] directional code cleanup: patch #1
Home

[Freeciv-Dev] Re: [PATCH] directional code cleanup: patch #1

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Jason Dorje Short <jshort@xxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [PATCH] directional code cleanup: patch #1
From: Trent Piepho <xyzzy@xxxxxxxxxxxxx>
Date: Wed, 15 Aug 2001 11:45:10 -0700 (PDT)

On Wed, 15 Aug 2001, Jason Dorje Short wrote:
> > > > >
> > > > > They are macros, but act just like functions (and could be made so in
> > > > > the future).

The thing is they aren't just like functions.  DIR_IS_CARDINAL evaluates it's
argument four times.  If you put something with side effects, like dir++, in
there, it would make a big difference.

> > > How come this convention isn't held by, say, the iteration macros?

Maybe because there is no such thing as an iteration function, so it's already
clear that it must be a macro.  I suppose it should be in all caps, but
whoever wrote the first one (and that was a long time ago, before I started,
which is before just about everyone on this list) decided that it was clear
enough that is was a macro by it's nature, and the less aesthetically pleasing
all caps name could be avoided.

> > The code isn't perfect. If you want to do it... At least for new code
> > this schema can be adopted.
> 
> OK...if this is convention, I will certainly follow it.  That the
> iteration macros (and others IIRC) don't follow it may indicate that not
> everyone agrees with the convention, though.

Other than the iterator macros, probably 99% of the macros are in all caps. 
Many of the ones that aren't in caps used to be functions, but then got
changed into macros, or are simple portability name change macros like
#define my_foo(x) foo(x).



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