bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: printf and ENOMEM


From: Bruno Haible
Subject: Re: printf and ENOMEM
Date: Tue, 3 Feb 2009 02:46:34 +0100
User-agent: KMail/1.9.9

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

[Prev in Thread] Current Thread [Next in Thread]