
which of course alway fails on 64 bit platforms because LONG_MAX is a 64 bit number.
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.
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.
Opinions, anyone?
Tricky, but looking at the intent of the tests, it seems like we should start with the largest number that will fit in a 32-bit type: so maybe we should change LONG_MAX to 0x7FFFFFFFL and ULONG_MAX to 0xFFFFFFFFL. As you say the alternative is to revamp the tests to start testing from a 64-bit type when LONG_MAX > 0x7FFFFFFFL. I'd say go with whichever you have the time for ;-) John.