[LTP] [PATCH 1/1] aiodio: Fix format string for 32bit

Cyril Hrubis chrubis@suse.cz
Fri Aug 5 11:34:31 CEST 2022


Hi!
> On 32bit char pointer is int and size_t is unsigned int,
> Cast to long / unsigned long.

Actually char pointer is char pointer, that is not an integer type at
all. If you do a pointer difference you end up with an signed integer
value of ptrdiff_t type, because unlike the result of sizeof(foo)
pointer difference can be negative as well. In C99 ptrdiff_t can be
printed as %td see the "Length modifier" part of man 3 printf.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list