Sender: rich AT phekda DOT freeserve DOT co DOT uk Message-ID: <3D71BC30.FF92C656@phekda.freeserve.co.uk> Date: Sun, 01 Sep 2002 08:05:20 +0100 From: Richard Dawe X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586) X-Accept-Language: de,fr MIME-Version: 1.0 To: DJGPP workers Subject: Re: DJGPP Bug Activity References: <200208041000 DOT g74A01p23895 AT delorie DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Hello. DJ's Server wrote: > > This is an automatic daily mailing. If you have problems with it, > send email to DJ at dj AT delorie DOT com > > 08/03/2002 16:31:03: Create 000354:2.03 printf()'s %#08x handling of 0 wrong > ----- c.c starts. ----- > #include > > int main(void) > { > > printf("%#08x %#08x\n", 1, 0); > > return 0; > } > ----- c.c ends. ----- [snip] > > ./c > 0x000001 00000000 > > Expected result: > 0x000001 0x000000 > > Note how the "x" is a zero. I think you are expecting the wrong thing. Here's what SUSv2 says about the '#' flag in its page about fprintf: "# This flag 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 0. For x or X conversions, a non-zero result will have 0x (or 0X) prefixed to it. For e, E, f, g or G conversions, the result will 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 conversions, trailing zeros will not be removed from the result as they normally are. For other conversions, the behaviour is undefined." A draft of C99 seems to say the same thing. So I think this report can be closed. Bye, Rich =] -- Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]