Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2004:
[Freeciv-Dev] (PR#7279) Macro optimizations
Home

[Freeciv-Dev] (PR#7279) Macro optimizations

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: a-l@xxxxxxx
Subject: [Freeciv-Dev] (PR#7279) Macro optimizations
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 26 Jan 2004 19:49:11 -0800
Reply-to: rt@xxxxxxxxxxx

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

> [rwetmore@xxxxxxxxxxxx - Tue Jan 27 02:43:58 2004]:

> If the maintainers have done their homework, understood ths issues,
> presented all the arguments and with the concensus of the community
> reached a decision to change core Freeciv standards or start a new
> version written in C++, then that is fine.

Do you think we'll get any consensus?

Here are the code requirements I'd impose:

1. Each macro must evaluate each of its arguments exactly once.
2. No function-like macro should impose additional restrictions that a
   function would not.  Specifically this refers to the sequence point
   problem.
3. Any macro that pretends to be a loop must respect "break".
4. Inlining should only be used when it gives a substantial improvement
(in speed or code size) over macro or traditional function forms.

These are all technical specifications.  The point is that any macro
that looks like a function or loop must _behave_ like a function or
loop, so that the normal rules of C apply.

#1 and #3 would require some fixes to existing macros.  #1 may also
preclude some current macros from being written in function form.  #2
and #4 are not currently a problem anywhere AFAIK.

Discuss.

jason



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