On Mon, 25 May 2020 at 10:22, Jakub Wilk <jwilk@xxxxxxxxx> wrote: > > Hi Jürgen! > > * Jürgen Sauermann <mail@xxxxxxxxxxxxxxxxxxxx>, 2020-05-24, 16:11: > >This lets me wonder if the fact that my glibc version accepts (and > >discards) a 0x prefix in a 'X' conversion is merely a convenience that > >may disappear at some later point in time, or an intended feature on > >which a programmer may rely on. > > It's an intended feature. C99 (and POSIX) requires stripping "0x". Thanks for checking that Jakub. Of course Jürgen is right that the manual page should leave the programmer in no doubt on the behavior here. I applied the patch below. Thanks for the report, Jürgen. Cheers, Michael --- a/man3/scanf.3 +++ b/man3/scanf.3 @@ -427,7 +427,12 @@ pointer to .IR "unsigned int" . .TP .B x -Matches an unsigned hexadecimal integer; the next pointer must +Matches an unsigned hexadecimal integer +(that may optionally begin with a prefix of +.I 0x +or +.IR 0X , +which is discarded); the next pointer must be a pointer to .IR "unsigned int" . .TP -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/