public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* printf() and _write() in newlib-nano
@ 2017-04-19  8:55 massimiliano cialdi
  2017-04-19 15:17 ` Craig Howland
  0 siblings, 1 reply; 2+ messages in thread
From: massimiliano cialdi @ 2017-04-19  8:55 UTC (permalink / raw)
  To: newlib

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: printf() and _write() in newlib-nano
  2017-04-19  8:55 printf() and _write() in newlib-nano massimiliano cialdi
@ 2017-04-19 15:17 ` Craig Howland
  0 siblings, 0 replies; 2+ messages in thread
From: Craig Howland @ 2017-04-19 15:17 UTC (permalink / raw)
  To: newlib

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-19 15:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-19  8:55 printf() and _write() in newlib-nano massimiliano cialdi
2017-04-19 15:17 ` Craig Howland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).