RFD: selective linking of floating point support for *printf / *scanf

Freddie Chopin freddie_chopin@op.pl
Wed Sep 3 20:08:00 GMT 2014


Hi!

Sorry if I missed something, but I have an idea that wasn't (probably) 
mentioned.

How about implementing printf()/scanf() to call external functions to do 
processing of a token? For example when printf() encounters %f it calls 
__printf_handle_f(). This calls would be implemented in a way that this 
function can actually do nothing (just consume some input in case of 
scanf() or load variable from va_list and print nothing in case of 
printf(), but do nothing else), so you could have 2 versions of these 
functions - one normal, which does what it's supposed to do (so uses 
floating point calculations), and another one, which would be a stub 
just consuming input or printing nothing (this is pretty simple and no 
floating point math). The version could be selected with a switch for 
linker, manually selecting the library or some other way.

In the first stage it would be quite OK to have only "normal" versions 
and we could just redefine symbols in user code to point to empty stubs (;

Regards,
FCh



More information about the Newlib mailing list