Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2004:
[Freeciv-Dev] Re: (PR#8239) Speclist generator
Home

[Freeciv-Dev] Re: (PR#8239) Speclist generator

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: per@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#8239) Speclist generator
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Tue, 23 Mar 2004 06:50:34 -0800
Reply-to: rt@xxxxxxxxxxx

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

On Tue, Mar 23, 2004 at 06:23:37AM -0800, Per I. Mathisen wrote:
> 
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=8239 >
> 
> On Tue, 23 Mar 2004, Raimar Falke wrote:
> > Wrong word. I mean that all functions and types for a certain
> > object/class (like city) are all in the same file.
> 
> Well. From a programmer's perspective, there is no difference. Both are
> included. From the compiler's perspective, I don't see much difference,
> either.

From a compiler's perspective both are included. But from a
programmer's perspective you have all you need in one file or not.

> (Except perhaps that a generator'ed speclist header file is much easier to
> read than speclist.h)

You don't need to read speclist.h as a normal programmer.

> > > > That we should ban macros and inline functions from the header files.
> > >
> > > Then where do we put them?
> >
> > Make all normal functions and put them in the .c file. And yes I
> > exclude things like iterate here which have to be macros.
> 
> I must be missing something. Don't inline functions have to be implemented
> in a header file if they are to be used in several files?

Yes. And yes I want to imply that macros and inline function should be
avoided if you want a readable header file. Some solution exists. For
example a generator which moves code from the .c to the .h file of
requested by the user. See my earlier mail.

> > > It is a bit complicated. The core problem is that you can neither
> > > conditionally define a macro nor expand macros in a macro name.
> >
> > Both are possible. See CHECK_MAP_POS and SPECLIST_PASTE. The latter
> > isn't beautiful but possible.
> 
> Ugh. What I meant to write is: can neither define a macro that defines a
> macro nor define macros names containing macros.

I agree with the first but I'm not sure with the second. The question
is really want you want to do here.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "The two rules for success in life are:
  1) Never tell them everything you know."




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