[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: long long unsigned on 32-bit machines
From: |
Hal Murray |
Subject: |
Re: long long unsigned on 32-bit machines |
Date: |
Sat, 25 Jan 2020 23:42:21 -0800 |
There are at least 2 ways to fix that.
There are a bunch of symbols to handle this mess: PRIu64 and friends are
defined in /usr/include/inttypes.h It's
/usr/include/inttypes.h:# define PRIu64 __PRI64_PREFIX "u"
# if __WORDSIZE == 64
# define __PRI64_PREFIX "l"
# define __PRIPTR_PREFIX "l"
# else
# define __PRI64_PREFIX "ll"
# define __PRIPTR_PREFIX
# endif
That ends up looking very ugly to my eye.
printf("%" PRIu64 "\n", t);
--------
You can cast the thing you want to print to (unsigned) long long and use ll.
printf("%llu"\n", (unsigned long long)t);
--
These are my opinions. I hate spam.
Re: long long unsigned on 32-bit machines, Gary E. Miller, 2020/01/27
Re: long long unsigned on 32-bit machines, Greg Troxel, 2020/01/26