Author: Omid David Tabibi
Date: 15:45:28 07/24/04
Go up one level in this thread
On July 24, 2004 at 15:38:36, Dieter Buerssner wrote:
>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).
I do the following:
#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))
>
>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.