Re: Compiling PowerLoom C++

Thomas Russ <[email protected]> Sun, 14 Feb 2010 10:47:34 +0000
Newsgroups gmane.comp.ai.powerloom
Message-ID <[email protected]>
On Feb 14, 2010, at 4:40 AM, Cameron Ross wrote:

> Hello,
>
> I'm trying the compile the C++ version of PowerLoom version 3.2.52.   =

> Running make from .../native/cpp/stella gives copious errors similar  =

> to: hierarchy.cc:97: error: cast from =91stella::Object*=92 to  =

> =91stella::boolean=92 loses precision.  This error refers to what seems  =

> to be a recurring theme throughout PowerLoom's C++ codebase.  Just  =

> wondering why the boolean cast is required.  Also, wondering why its  =

> not compiling for me, when clearly this idiom must have worked with  =

> gcc at some point.  I'm running 64bit Ubuntu Linux 9.10 with g++  =

> version 4.4.1.  Note that the code associated with this specific  =

> error is:
>
>     if (!((boolean)(self))) {
>           stream << "!NULL!";
>     }


Looking at this a bit more closely, what it turns out to be is an  =

"optimization" in the generated C++ code to implement at  test for a  =

null object.  Now, I'm not completely sure of all of the background,  =

but I suspect that at one point there was a C compiler that complained  =

about using a non-boolean in a boolean test, so a cast is used.  (Or  =

it could be that the cast is just created because of the casting used  =

in Stella to generate the optimization.

Is this error actually stopping the generation of code, or is this  =

more of a warning rather than a hard error?  I don't happen to have  =

gcc 4.4 installed.  All I have is 4.0 and 4.2 right now.  G++ 4.0  =

certainly doesn't complain about that construct at all.