Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: 64-bit long long in GNU C

Author: Dieter Buerssner

Date: 16:05:45 07/24/04

Go up one level in this thread


On July 24, 2004 at 18:45:28, Omid David Tabibi wrote:

>#if defined (_MSC_VER)
>#  define _LL(n)		(n ## I64)
>#  define _ULL(n)		(n ## UI64)
>#else
>#  define _LL(n)		(n ## LL)
>#  define _ULL(n)		(n ## ULL)
>#endif
>
>So, in the above example I will do:
>
>if (variable == _ULL(0x123456789abcdef))

Yes, this is a nice method. Unfortunately, it is not all, that is needed. You
will need some other tricks for printf formats, too. Until now, it is still not
so straightforward, to use 64-bit types in portable code.

Why the leading underscore? Names starting with an underscore and an upper case
letter are not free to use for (portable) user code. They are reserved for the
compiler. I see often those leading underscores, I always wondered why?

Will MSVC need the UI64 or will it only warn, too? For Gcc (or other compilers,
that implement (unsigned) long long according to the C Standard), it is not
needed. In general, I prefer to live with some harmless warnings, instead of
writing code, that only is there, to avoid warnings.

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.