Computer Chess Club Archives


Search

Terms

Messages

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

Author: Dieter Buerssner

Date: 12:38:36 07/24/04

Go up one level in this thread


On July 24, 2004 at 14:58:51, Stuart Cracraft wrote:

>I am printing it out with
>
>  long long variable;
>  ... do stuff to set variable ...
>  printf("llx\n",variable);

% sign is missing. Note that "llx" expects unsigned long long, not (signed) long
long. It will most probably work, but is not totally correct.

>but when I put this elsewhere in the code
>
>  if (variable == 0x....)
>
>the compilation balks with
>
>  ga.c:2959: warning: integer constant is too large for "long" type

Is variable really long long, and not long? If yes:

It's just a harmless warning. You can ignore it. The code is correct (according
to the C-Standard). You can get rid of the warning with

if (variable == 0x123456789abcdefULL)

It is unfortunately not very portable yet (although it is in the the ISO C
Standard of 1999).

16 bit compilers gave (and still give) similar warnings for

unsigned long var=0x12345678

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.