Author: Dieter Buerssner
Date: 10:09:53 03/20/04
Go up one level in this thread
On March 20, 2004 at 10:48:04, Heiner Marxen wrote: >On March 19, 2004 at 16:43:24, Pat King wrote: > >>unsigned long long I = (unsigned long long)1 << 35; // I'm guessing this is more >>//portable than '1LLU'? > >You should make a typedef for your 64-bit type, like > >typedef unsigned long long U64_t; > >U64_t I = (U64_t)1 << 35; I am not 100% sure, but I think, U64_t may be a reserved name in POSIX/XOPEN (and all names ending with _t). The glibc manual writes under reserved names: "Names that end with _t are reserved for additional type names." So for maximum portability, one might use another name for the typedef. >Yes, that way (with the cast) it is more portable than the suffix with LL, >since you only need to get the typedef right. >Another portability problem is the printf format for such values. Indeed. It is easy to change one typedef, but not easy to change many printf format specifiers (especially, when one didn't think of it in advance). It is also the reason, that I was too lazy until now, to change all my counters (which are typically unsigned long) to avoid overflow (node counters overflow in the order of magnitude of one hour on a typical modern computer). If the printf were few, it wouldn't be a large problem. But I have them in masses (especially in debugging code). Definetly an advantage of C++ with its typesafe printing facilities. 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.