From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2004-09-01 14:34:32


Jonathan Wakely wrote:

> On Wed, Sep 01, 2004 at 12:50:32PM +0200, Markus Schöpflin wrote:

>>A possible fix would be to start the test with 64 bit and not 32 on 64 bit
>>platforms. But how can 64 bit platforms be detected? Probably with #if
>>(LONG_MAX > INT_MAX) ... #endif or something like this.
>
> This is not _guaranteed_ to work, but would be OK in practice.
>
> An ILP64 platform would have sizeof(int) == sizeof(long) == 8
> and an LLP64 platform would have sizeof(int) == sizeof(long) == 4
>
> In both cases LONG_MAX == INT_MAX.
>
> I think all 64-bit unices use the LP64 model, where sizeof(int) == 4 and
> sizeof(long) == 8, so I think your suggestion would work.

Do you know of a way which would work portably?

>>Another fix (which ignores 64 bit values alltogether) would be to change
>>the lines above to not use long and LONG_MAX but int and INT_MAX.
>
> As I understand it that just changes the bad assumption that long is
> 32-bits to assuming that int is 32 (or fewer) bits, which is still an
> unportable assumption, but likely to work for the foreseeable future
> (famous last words :-)

Yes, right. But it would just be a fix to make the tests succeed, it
wouldn't really count for much on a 64 bit platform.

Maybe one of the authors of this test could perhaps voice an opinion on
what to do?

Markus