[uClibc] printf and non-decimal bases

John Williams jwilliams at itee.uq.edu.au
Mon Aug 18 22:51:52 UTC 2003


Manuel Novoa III wrote:
> On Mon, Aug 18, 2003 at 01:50:55PM +1000, John Williams wrote:
> 
>>I've ported uClibc to the microblaze FPGA-based soft-processor as part 
>>the uclinux port that platform. Everything seems to work well - memory 
>>allocation, IO, signal handling, all the usual suspects.
>>
>>However, one remaining uclibc gremlin has me confused.  printf always 
>>prints zeros if you try to output a number in a non-decimal base.
>>
>>Thus, printf("%d",intvar) works fine, however printf("%x",intvar) and 
>>the octal equivalent always produce zeros.
>>
>>The same happens when first creating the strings with sprintf and so on, 
>>so it's somewhere deep in there.
>>
>>Has anybody seen anything like this before, or have any suggestions on 
>>where I should look?
> 
> 
> Nothing like that has ever been reported.  It is very strange, since
> all the integer conversions in *printf are done by the _uintmaxtostr()
> call in _do_one_spec().  Only the base passed is different.  You might
> try looking there.  Another thing you might try (to make debugging
> easier) is configuring uClibc to use the old vfprintf implementation.
> It is a lot simpler since it doesn't support wide char, positional arg,
> or custom printf specifier functionality.

Thanks for your reply Manuel - at least I know where to look now.  I'll 
report back if I find anything interesting.

Cheers,

John




More information about the uClibc mailing list