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

[Freeciv-Dev] Re: (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] Re: (PR#7279) Macro optimizations
From: "Jason Short" <jshort@xxxxxxxxxxxxxx>
Date: Wed, 21 Jan 2004 17:28:23 -0800
Reply-to: rt@xxxxxxxxxxx

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


> On Wed, Jan 21, 2004 at 09:24:41AM -0800, Arnstein Lindgard wrote:

>> On Tue, 20 Jan 2004 17:10:39 -0800 rwetmore@xxxxxxxxxxxx wrote:
>>
>> > Some interesting comments on inline functions from Stroustrup.
>> >
>> >    The order of evaluation of actual arguments to functions is udefined.
>> >    In particular, an inline expansion is not required to preserve the
>> >    order of evaluation of actual arguments that the implementation ould
>> >    have produced for an out-of-line call. Since one call of a
function in a
>> >    program may be inlined while another is handled by the normal fnction
>> >    call mechanism, this can lead to two calls to the same function with
>> >    identical actual arguments yielding different results.
>>
>> Can the order of evaluation of function arguments really be relevant?
>
> Not the last time I checked this. splint reports this. It is bad/wrong
> even without inlineing.

I can't believe this is being used as an argument *against* using
functions in favor of macros.  Although the order of evaluation of
arguments may be undefined in an inline function call, at least you know
that each argument will be evaluated *exactly once*.  In a macro you get
no such guarantee.

jason





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