[exim] Test code (Anyone using platform without 64-bit integ…

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Phil Pennock
Dátum:  
Címzett: exim-users
Régi témák: [exim] Anyone using platform without 64-bit integers?
Tárgy: [exim] Test code (Anyone using platform without 64-bit integers?)
On 2013-12-02 at 17:06 -0500, Phil Pennock wrote:
> We have to decide on how to resolve a coding issue in Exim, and there
> are two fixes available. One fix adds a bunch of complexity. The other
> fix just starts using 64-bit integers. I _think_, that as we approach
> 2014, we can now rely upon 64-bit integers being available, but we don't
> want to leave a platform behind if it's still in use with Exim.


Note: 64-bit integers are often available on 32-bit userlands. A 32-bit
kernel, or a VM, shouldn't matter.

You should be able to compile and run this, and see "4294967297" printed
twice, which is (2^32 + 1):

----------------------------8< cut here >8------------------------------
#include <stdint.h>
#include <stdio.h>

int
main(int argc, char *argv[]) {
    int64_t s64;
    uint64_t u64;


    s64 = 1LL + (1LL << 32);
    u64 = 1LL + (1LL << 32);


    printf("signed: %lld\nunsigned: %llu\n", s64, u64);
}
----------------------------8< cut here >8------------------------------


If that works, then you're fine. If it doesn't work, then we need to
figure out if that's because your system is so old that it doesn't like
<stdint.h> and the LL modifier, or if it's because your system really
truly doesn't support 64-bit integers in C source code.

Thanks,
-Phil