[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Mon, 25 Jan 2010 10:57:07 +0100
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;
> > 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.
Take as example