gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnugo-devel] 3.0 portability problem


From: Gunnar Farneback
Subject: Re: [gnugo-devel] 3.0 portability problem
Date: Tue, 09 Oct 2001 19:02:59 +0200
User-agent: EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/20.7 (sparc-sun-solaris2.7) (with unibyte mode)

Teun wrote:
> we could also test for SIZEOF_INT > 4
> SIZEOF_INT is already set by configure in config.h.

This is exactly why I wrote

> This can be solved either by including config.h in random.c or by
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> applying the following patch, which I think is a better solution.

The replaced code looked like this

  #if (CHAR_BIT * SIZEOF_INT > 32)

which is the correct way of doing this, although platforms with
CHAR_BIT != 8 are kind of rare today. But I still think my patch is
better because it gives a robust test which doesn't require including
config.h. The reason why this is to prefer is that a random number
generator is completely standalone and potentially useful for other
projects, so the fewer dependencies it has, the better.

/Gunnar



reply via email to

[Prev in Thread] Current Thread [Next in Thread]