On Mon, Jan 25, 2010 at 10:57:07AM +0100, Bruno Haible wrote:
> Robert Millan wrote:
> > >   - In the average case, you can get away with 1 strftime call instead of 
> > > 2,
> > >     if you preallocate a buffer on the stack:
> > >       char buf[256];
> > >       len = strftime (buf, sizeof (buf), "%c", loctime) + 1;
> > >     In the case where 256 bytes are not enough, the function will need
> > >     3 strftime calls instead of 1, but this case should be pretty rare
> > >     (even in Chinese and GB18030 encoding, 64 characters should be enough
> > >     for a date + time display).
> > 
> > What about http://www.gnu.org/prep/standards/standards.html#Semantics ?
> > Avoiding arbitrary limits is a good thing IMO.
> 
> I'm not suggesting to introduce an arbitrary limit, but rather a threshold
> below which the implementation is more efficient that above the threshold.

Ok then.  But if I preallocate a buffer on the stack, then xctime() can't
return it.  I suppose you want it to preallocate on heap?

-- 
Robert Millan

  "Be the change you want to see in the world" -- Gandhi


Reply via email to