Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2003:
[Freeciv-Dev] Re: (PR#6781) Cleanups
Home

[Freeciv-Dev] Re: (PR#6781) Cleanups

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#6781) Cleanups
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Sun, 9 Nov 2003 08:21:48 -0800
Reply-to: rt@xxxxxxxxxxx

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

On Sun, Nov 09, 2003 at 06:39:13AM -0800, Gregory Berkolaiko wrote:
> 
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=6781 >
> 
> On Sun, 9 Nov 2003, Raimar Falke wrote:
> 
> > 
> > <URL: http://rt.freeciv.org/Ticket/Display.html?id=6781 >
> > 
> > On Sun, Nov 09, 2003 at 03:49:05AM -0800, Gregory Berkolaiko wrote:
> > > 
> > > <URL: http://rt.freeciv.org/Ticket/Display.html?id=6781 >
> > > 
> > > On Thu, 6 Nov 2003 rt@xxxxxxxxxxx wrote:
> > > 
> > > > 2)
> > > > ai/aiunit.c:591:134: Expression has undefined behavior (left operand
> > > > uses errno, modified by right operand): log(most_desirable / ((((100 *
> > > > 5 * 81 + 100 * (9 - 5) * 51) + 1) + 1) + (100 * 5 * 81 + 100 * (9 - 5)
> > > > * 51))) / log(0.6)
> > > > Code has unspecified behavior. Order of evaluation of function
> > > > parameters or subexpressions is not defined, so if a value is used and
> > > > modi fied in different places not separated by a sequence point
> > > > constraining evaluation order, then the result of the expression is
> > > > unspecified.
> > > 
> > > I do not understand this error at all.  Mathmatically, the order of 
> > > evaluation is well defined.
> > 
> > The result is but log has the side effect that is modifies errno. So
> > the value of errno after the "log(x)+log(y)" is unspecified because
> > the order of the log calls is unspecified.
> 
> Ah.  So if we split it into two, it should be fine?

Yes because there is a sequence point (the ;) between them which
specifies the order.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  This customer comes into the computer store. "I'm looking for a mystery
  Adventure Game with lots of graphics. You know, something realy
  challenging". "Well," replied the clerk, "have you tried Windows 98 ?"




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