control: reassign -1 glibc-doc-reference control: retitle -1 glibc-doc-reference: wrong description of the '#' printf flag control: tag -1 + upstream On 2015-12-20 01:40, Noel Torres wrote: > On Thursday, 17 de December de 2015 18:47:58 usted escribió: > > On 2009-01-05 04:50, Noel David Torres Taño wrote: > > > Package: libc6 > > > Version: 2.7-16 > > > Severity: normal > > > > > > > > > Conversion %#04hhx in printf means "convert the argument to a uint8_t > > > (hh) and show it as an hexadecimal number (x) with leading zeros if > > > necessary (0) and a leading 0x prefix (#) in a field of total lenght > > > four (4), that is, two places for 0x and two for the argument value". > > > > > > If the argument is 0 the expected behaviour is to show 0x00 but it shows > > > 0000 > > > > > > With other arguments it works ok. > > > > printf has the correct behaviour as the value 0 is a special case. > > > > Quoting POSIX [1]: > > | # > > | > > | Specifies that the value is to be converted to an alternative form. > > | For o conversion, it increases the precision (if necessary) to force > > | the first digit of the result to be zero. For x or X conversion > > | specifiers, a non-zero result shall have 0x (or 0X) prefixed to it. > > | For a, A, e, E, f, F, g , and G conversion specifiers, the result > > | shall always contain a radix character, even if no digits follow the > > | > > | radix character. Without this flag, a radix character appears in the > > | result of these conversions only if a digit follows it. For g and G > > | > > | conversion specifiers, trailing zeros shall not be removed from the > > | result as they normally are. For other conversion specifiers, the > > | behavior is undefined. > > | 0. > > > > As you can see the '0x' prefix is added only for a non-zero value. > > That is why '0000' is the correct output here. > > Then, there is a bug in the documentation of the printf function. Indeed. > Please fix it there. > > > > I am therefore closing the bug. > > Please, reopen and consider as a documentation bug. This mail should reopen the bug and reassign it to the glibc-doc-reference package providing the documentation. Aurelien -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurelien@aurel32.net http://www.aurel32.net
Attachment:
signature.asc
Description: PGP signature