msvcrt: portable printf integer conversions
Mike McCormack
mike at codeweavers.com
Mon Sep 26 23:02:14 CDT 2005
Jesse Allen wrote:
> I've read various printf implementation over time. The last one,
> ReactOS, seemed to provide support for numbering systems base 2
> through 36. You'll see my version does mimic theirs, but we never do
> anything other than 8, 10, and 16. I'm not sure if there is any
> printf out there that actually allows you to specify the base. For
> this patch it could easily be cut to the 'f' as maximum, except I use
> the 'x' digit in the case of the special 0x and 0X prepending cases.
> To change that, we just add in a test for the large type there.
Generally if something isn't used, then it shouldn't be included. You
specified your 'x' as digits[33], and you could easily delete the rest
of the alphabet after 'f' and use digits[16] for 'x'.
> I will pull up my patch of test cases (never applied) from last time
> and see if it will still work against cvs.
Somebody (not you, i think) submitted a few test cases before that did
something like:
printf(buf,"%s %d %c\n", "blah", 10, 'x' );
ok( strlen(buf) == 9, "wrong length\n" );
That doesn't test the code so well, so please make sure to check the
output is correct in an unambiguous way. eg.
ok( !strcmp(buf,"blah 10 x"), "wrong output\n");
I'd check some combinations of stuff like:
( %I64x %0I64x %1I64d %i64x %i64d %I64D %50I64d %-1I64d %-50I64d etc )
for values: 0, -1, ~1, ~0, 100, -100
Mike
More information about the wine-devel
mailing list