Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: For Joshua Haglund (home-compiled-Fruit output problem)

Author: Dieter Buerssner

Date: 03:31:49 03/29/05

Go up one level in this thread


On March 29, 2005 at 02:39:09, Fabien Letouzey wrote:

>However I always forget that (new to me) MinGW compiler that claims to be GCC on
>Windows.  Many things that work with Cygnus GCC don't with MinGW it seems (MinGW
>cannot compile PolyGlot for instance).

No surprise. MinGW is a real Gcc, but there is no glibc or any other Posix C lib
included (which the Cygwin environment has). As I understand it, MinGW is using
the native Windows libraries/Dlls. It supports all those Win API calls (which
Cygwin does not).

>I already use a conditional definition for 64-bit integer display.  What's
>needed is to add MinGW to the list of compilers that require %I64u.  What is the
>compiler "define" for (all versions of) MinGW?

I use slightly different logic at 2 places. For getting a 64 byte type, I use
the __GNUC__ question. For time functions and input polling (here Windows style
is needed), I use _WIN32.

Why don't you want to use %f? I just now remember that it comes with a trap:
MSVC 6 cannot cast unsigned __int64 to double (there also is no instruction on
x86 that can load an unsigned 64 bit integer into a floating point register,
there is one for signed 64 bit integer). One can use a double cast unsigned
__int64 -> signed __int64 -> double, or just use signed integer for the node
counter.

NODE_TYPE nodes; /* long long or __int64 or even double or long double */
                 /* Or even plain long on some platforms, that support neither
                    long long nor __int64 and that may or may not have
                    64 bit long */

printf("%.0f nodes\n", (double)nodes);

Until the major compilers all support the C99 Standard (this aspect of it at
least - perhaps it will never happen ...) this seems to be the method with the
least hazzle and without ugly #defined format specifiers in the middle of format
strings.

>BTW, why would a GCC-claim-to-be compiler use M$ convention???

It is Gcc, just no Standard C99 compliant lib (which glibc is neither, but it
supports %llu).

Regards,
Dieter



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.