#368 float support for sprintf

open
nobody
5
2012-06-11
2012-06-11
No

As seen at bug report #3509709, sdcc's sprintf does not handle float by default, which makes it non-compliant wrt. the standard. On the other hand float support ahs some overhead, which some may not be happy with. I thus suggest the following solution:

1) Make sprintf handle float by default.
2) Offer an additional function, e.g. __sdcc_nofloat_sprintf that does not handle float and thus is smaller and faster.

That way there are no nasty surprises when using sprintf, and there still is a way to save some code size.

Philipp

Discussion

  • Maarten Brock
    Maarten Brock
    2012-12-28

    Many other embedded compiler suites solve this by letting you tell the linker the preferred implementation. They have several implementations in their library and a linker switch tells which one to pick. But to my knowledge they all default to a small implementation without extensive float printing capabilities.