[Top][All Lists]

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

Re: [avr-libc-dev] vfprintf warnings

From: Joerg Wunsch
Subject: Re: [avr-libc-dev] vfprintf warnings
Date: Mon, 11 Nov 2002 22:51:32 +0100
User-agent: Mutt/1.2.5i

As E. Weddington wrote:

> > Hehe, the smallest version should fit into a 2 KB device, even with
> > some user code. ;-)
> Whew! You've been busy! :-)

Well, honor where honor is due: Alexander really did his best to
provide an optimized version of his printf_p() implementation
(before he had to go to the Bulgarian army so he can't follow much
of our discussion now).  Unfortunately, some of his optimizations
had side effects like the possibility to cause buffer overflows
by specifying a too large precision for the (integer) output.  I
wasn't very comfortable about this, and added checks, which bloated
the code somewhat.

Then, some useful features were missing.  I added them, which bloated
the code, somewhat. :)

His buffer processing wasn't quite compatible with an extension for
floating point formatted output.  To add floating point, i could
have added a complete second processing code path, but rather decided
to modify Alexander's version instead.  This eventually lifted some
further restrictions of his code, you can now also process integer
conversions with (almost, i. e. <= 127) arbitrary width and/or
precision -- but you name it: it bloated the code, somewhat. :-)

So in the end, i decided to produce a cut-down version that can just
do some formatted output, but no gimmicks.  Field width, precision,
%# alternate formatting, all has been left out.  This version is then
even smaller than Alexander's version, but i guess might still be of
some use for people who are tight on space.  The standard version is
approximately < 1.5 KB (depending on the avr2...avr5 architecture),
Alexander's version was ~ 1 ... 1.2 KB.  Floating point is beyond
all that, and needs a lot more from libm as well, so it certainly
only starts to get useful with 8 KB devices, where more flash would
be nice.
J"org Wunsch                                           Unix support engineer
address@hidden        http://www.interface-systems.de/~j/

reply via email to

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