Simon Josefsson wrote:
> >>> printf can fail for reasons like ENOMEM ...
> >> 
> >> Does this problem occur in practice on any modern platform?
> >
> > ... the failure scenario is
> > more likely to occur when using formats that produce lots of output (large
> > precisions), or convert floating point to decimal, neither of which should
> > be the case for these statements.
> 
> So maybe the answer really is no, then, at least as far as this code is
> concerned?
> 
> Is this something the gnulib printf module can detect and work around?

Actually, with the gnulib 'printf-posix' module, the probability of getting
ENOMEM is higher than with the native printf() function: because lib/vfprintf.c
accumulates the output into a string, whereas native printf() implementations
internally operate on a stream and need less intermediate strings (possibly
not even for padding).

Bruno


Reply via email to