[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c

sprintf implementation

pozz

5/26/2011 8:54:00 PM

In my embedded environment, I have a C standard library with a very
complete sprintf() function. However, when I use that function, the code
size increases too much.

I'd like to compare other simple sprintf() implementations to use
instead of the original one. I'm interested only in 'x', 'u', 'd', 's'
and 'c' converters with 'l' modifier (for long). I'm not interested in
'p', 'f', 'g' and so on.

Can you point me to any simple sprintf() implementation?
3 Answers

blp

5/26/2011 8:56:00 PM

0

pozz <pozzugno@gmail.com> writes:

> Can you point me to any simple sprintf() implementation?

Here's one that I wrote. It is imperfectly portable.

http://benpfaff.org/cgi-bin/gitweb.cgi?p=pintos-anon;a=blob;f=src/lib/stdio.c;h=8927c50555d9993ae1ac952e21bc3fe7deb93f...

--
"The lusers I know are so clueless, that if they were dipped in clue
musk and dropped in the middle of pack of horny clues, on clue prom
night during clue happy hour, they still couldn't get a clue."
--Michael Girdwood, in the monastery

Leo Havmøller

5/27/2011 3:41:00 AM

0

> In my embedded environment, I have a C standard library with a very
> complete sprintf() function. However, when I use that function, the code
> size increases too much.

Probably OT:
This is a fairly typical problem for small embedded systems, and some
embedded environment offer reduced printf and scanf implementations.
Commonly there are full, medium (no floats) and small (matches your
requirements). The selection is often done at link time in your linker
configuration file.
What embedded environment are you using?

Leo Havmøller.

pozz

5/27/2011 6:59:00 AM

0

On 27 Mag, 05:40, Leo Havmøller <rtx...@nospam.nospam> wrote:
> > In my embedded environment, I have a C standard library with a very
> > complete sprintf() function. However, when I use that function, the code
> > size increases too much.
>
> Probably OT:
> This is a fairly typical problem for small embedded systems, and some
> embedded environment offer reduced printf and scanf implementations.

Not in my case. There's only one not configurable implementation.
I haven't any idea what could be the space saving with another
sprintf()
implementation that lacks floating point and/or other conversions.


> Commonly there are full, medium (no floats) and small (matches your
> requirements). The selection is often done at link time in your linker
> configuration file.
> What embedded environment are you using?

Softune from Fujitsu.