[U-Boot] [PATCH 3/3] Remove <inttypes.h> includes and PRI* usages in printf() entirely

Masahiro Yamada yamada.masahiro at socionext.com
Tue Aug 7 02:11:43 UTC 2018


2018-08-06 22:20 GMT+09:00 Andy Shevchenko <andy.shevchenko at gmail.com>:
> On Mon, Aug 6, 2018 at 2:47 PM, Masahiro Yamada
> <yamada.masahiro at socionext.com> wrote:
>
>> The use of PRI* makes the code super-ugly.  You can simply use
>> "l" for printing uintptr_t, "ll" for u64, and no modifier for u32.
>
> This is not always the case. I dunno what exact usage of PRIx in
> U-Boot, but this is correct way for some size-variable types.
> So, if U-Boot is known of not using something like off_t, then we are fine.

U-Boot uses off_t.

All architectures use 'long' for off_t.
It is safe to use 'l' modifier for printing off_t variables.



As for Linux, only i386 use 'long long' for off_t, right?
To sum up,

  i386:                       long long   (64bit)
  other 32-bit architectures  long        (32bit)
  64bit architectures:        long        (64bit)


off_t is not even fixed-width type.

The weirdness of __kernel_long_t is interesting,
but unrelated to this patch.




> In any case the commit message should better justify this part (PRIu64
> is specified in standard).
>


-- 
Best Regards
Masahiro Yamada


More information about the U-Boot mailing list