avr-chat
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-chat] Printf with leading zeros?


From: Rick Mann
Subject: Re: [avr-chat] Printf with leading zeros?
Date: Tue, 1 Feb 2011 14:43:15 -0800

Thanks for that, but I'm still seeing issues. Note that in my last email, I 
mentioned that the behavior I'm seeing is *with* the floating-point version of 
the library.

Moreover, the docs you quoted say "but only the # additional option can be 
specified," although I don't know what that means, exactly. It seems to say 
that "#" can be used, but other flags cannot (including width specifiers). 
However, later on the page, under "Notes," it says "For default version the 
width field and the "pad to left" ( symbol minus ) option will work in this 
case," suggesting that the field width and pad-to-left flags work (in the case 
of floating point conversions, which render as question marks). This suggests 
that even in the default version of the library, field width specification 
should work.

None of that explains why some *values* result in different behavior.

Note that I don't mind losing the "#" flag, but that specifying zero-padding 
and field minimum width is required, and I don't get that with even the 
floating point version of the library.

-- 
Rick


On Feb 1, 2011, at 10:53:04, Andy Warner wrote:

> On Tue, Feb 1, 2011 at 12:32 PM, Rick Mann <address@hidden> wrote:
>> [...]
>> There is clearly something broken in the library.
> 
> Are you falling foul of the default stripped-down vfprintf() implementation.
> From the vfprintf docs @
> http://www.nongnu.org/avr-libc/user-manual/group__avr__stdio.html#gaa3b98c0d17b35642c0f3e4649092b9f1
> (scroll down a bit..)
> 
> ...
> Since the full implementation of all the mentioned features becomes
> fairly large, three different flavours of vfprintf() can be selected
> using linker options. The default vfprintf() implements all the
> mentioned functionality except floating point conversions. A minimized
> version of vfprintf() is available that only implements the very basic
> integer and string conversion facilities, but only the # additional
> option can be specified using conversion flags (these flags are parsed
> correctly from the format specification, but then simply ignored).
> This version can be requested using the following compiler options:
> 
>   -Wl,-u,vfprintf -lprintf_min
> 
> If the full functionality including the floating point conversions is
> required, the following options should be used:
> 
>   -Wl,-u,vfprintf -lprintf_flt -lm
> 
> ...
> 
> -- 
> Andy
> 
> _______________________________________________
> AVR-chat mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/avr-chat




reply via email to

[Prev in Thread] Current Thread [Next in Thread]