[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <99b8d630-131e-b8f7-eb81-d8bb1727da59@gmail.com>
Date: Fri, 11 Sep 2020 12:13:32 +0200
From: "Michael Kerrisk (man-pages)" <mtk.manpages@...il.com>
To: Alejandro Colomar <colomar.6.4.3@...il.com>
Cc: mtk.manpages@...il.com, linux-man@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 02/24] endian.3: Use 'PRIx32' rather than "%x" when
printing 'uint32_t' values
On 9/10/20 11:13 PM, Alejandro Colomar wrote:
> Signed-off-by: Alejandro Colomar <colomar.6.4.3@...il.com>
Just noting here for completeness: see the discussion in patch 01.
Thanks,
Michael
> ---
> man3/endian.3 | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/man3/endian.3 b/man3/endian.3
> index bdf1efd7e..3a898bb02 100644
> --- a/man3/endian.3
> +++ b/man3/endian.3
> @@ -147,6 +147,7 @@ htobe32(x.u32) = 0x11223344
> \&
> .EX
> #include <endian.h>
> +#include <inttypes.h>
> #include <stdint.h>
> #include <stdio.h>
> #include <stdlib.h>
> @@ -164,9 +165,9 @@ main(int argc, char *argv[])
> x.arr[2] = 0x33;
> x.arr[3] = 0x44; /* Highest-address byte */
>
> - printf("x.u32 = 0x%x\en", x.u32);
> - printf("htole32(x.u32) = 0x%x\en", htole32(x.u32));
> - printf("htobe32(x.u32) = 0x%x\en", htobe32(x.u32));
> + printf("x.u32 = 0x%"PRIx32"\en", x.u32);
> + printf("htole32(x.u32) = 0x%"PRIx32"\en", htole32(x.u32));
> + printf("htobe32(x.u32) = 0x%"PRIx32"\en", htobe32(x.u32));
>
> exit(EXIT_SUCCESS);
> }
>
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
Powered by blists - more mailing lists