This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]