On Thu, Jan 19, 2017 at 10:03 AM, Johan Hedberg <johan.hedberg@intel.com> wrote:
Hi Marcus,

On Thu, Jan 19, 2017, Marcus Shawcroft wrote:
> > The right format specifier for unsigned integers is %u and not %d, so as
> > far as I see that's the issue and using %u should make the error go
> Since the type is 'uint32_t' rather than 'unsigned' the correct specifier is:
> PRIu32
> e.g.
> #include <stdint.h>
> printf("blah %" PRIu32 " more blah", v);

Does "correct" in this case have any practical significance? It worsens
the readability of the code quite a lot IMO, so if the significance is
purely theoretical it's a quite high price to pay for correctness. I've
used the PRI* macros in other projects, but never for anything smaller
than 64 bit integers.

We need to take into consideration 3rd party code that we can't modify, so while it might work for the kernel code, we will still have issues with 3rd party code using %u.