Re: snprintf heads-up
| From: | Zeev Suraski | Date: | Fri, 08 Sep 2000 15:00:12 +0000 |
| Subject: | Re: snprintf heads-up | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-32683@lists.php.net to get a copy of this message | ||
On Fri, 8 Sep 2000, Jon Ribbens wrote:
> Zeev Suraski <zeev@zend.com> wrote:
> > > This may indeed be the most common case, but from the point of view of
> > > the people writing C libraries, they need to cater for as many people
> > > as possible. One behaviour satisfies only some people, the other satisfies
> > > everyone.
> >
> > This seems to be contradicting itself.
>
> Why?
>
> Case (a): snprintf returns bytes written
> * People extending buffer are screwed, they must write their own snprintf
> or do something horrible like repeatedly extend the buffer until snprintf
> succeeds.
> * People not extending buffer are happy.
> Case (b): snprintf returns bytes that *would* be written
> * People extending buffer are happy.
> * People not extending buffer are slightly less happy, but they can still
> achieve what they want quite easily.
That depends on the level of happiness of case (b) (2) :)
Zeev
--
Zeev Suraski <zeev@zend.com>
http://www.zend.com/