This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: snprintf and malloc
I was using floating point which may be why it is doing malloc().
Trampas
On Tue, Dec 5, 2017 at 4:05 PM, Freddie Chopin <freddie_chopin@op.pl> wrote:
> On Tue, 2017-12-05 at 15:47 -0500, Trampas Stern wrote:
> > It looks like the best option is to implement my own snprintf() and
> > avoid
> > using newlib's.
>
> Not the best approach in my opinion.
>
> You may always use sniprintf(), which does _NOT_ support any floating
> point formats, but it also does _NOT_ use malloc(). Generally in newlib
> there are non-floating-point variants of all printf- and scanf-like
> functions - just add the "i" right before printf/scanf and you are
> done. For example there is iprintf, siprintf, sniprintf, viprintf and
> so on.
>
> Regards,
> FCh
>