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: printf() and _write() in newlib-nano


On 04/19/2017 04:55 AM, massimiliano cialdi wrote:
I use newlib-nano in an embedded project.
I have implemented my version of _write() to make printf() output chars to UART.

I wonder if a single call of printf() results in a single call of _write(), or, otherwise _write() can be called more than once by printf().

best regards

Max
It depends on many factors (the actual print string, buffered, line buffered, text mode, etc.), but either alternative can happen--either one _write per print or more than one. It can range from one write per print to one per character. If it is important to you, it probably would be best to instrument it to find out directly, and you could observe how it varies.


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