On Sat, Nov 10, 2012 at 04:22:34PM +0000, Philip Ashmore wrote:
> Apologies in advance that this is off-topic or just a silly question.
>
> If I want my C source code to build correctly on x32, how do I
> choose the correct printf format strings for int32_t, int64_t etc?
Use the appropriate macro's:
#include <stdint.h>
#include <inttypes.h>
int32_t a;
int64_t b;
printf("a=%" PRIi32 ", b=%" PRIi64 "\n", a, b);
There is (almost) never a good reason to use __amd64__, __i386__ or similar
macro's to detect the size of standard types.
--
Met vriendelijke groet / with kind regards,
Guus Sliepen <guus@debian.org>
Attachment:
signature.asc
Description: Digital signature