Re: The snprintf problems...


Subject: Re: The snprintf problems...
From: Martin Sevior (msevior@mccubbin.ph.unimelb.edu.au)
Date: Tue Oct 23 2001 - 09:44:24 CDT


On Thu, 18 Oct 2001, Mike Nordell wrote:

> Martin Sevior wrote:
> > >
> > Mike,
> > Since you're interested in this, is is possible to implement
> > a way to snprintf into a UT_String?
>
> Possible? Yes. Would I do it, or would I even like it if something as
> type-unsafe as sprintf was added to it? No. There is a reason for me
> opposing this; locales.
>

Oh yeah.

> The only data-type that could be allowed in that format specification would
> be "%d". Not very useful, eh?
>

> strings into UT_String. "%f" would be unusable since it would require the
> process-wide C library locale (not to be confused with the "C" locale :-) )
> to be used.
>
> Should there be popular demand for string formatting except snprintf, I
> suggest we have another look at the level of conformance of C++ compilers
> and libraries instead. std::string already got all this, and more, not to
> mention locales can be imbued on a per-object basis, which would benefit AW
> performance in regards to writing and parsing strings to/from float.
>

Well if someone does come up with a UT_snprintf I'll happily begin
auditing abiword for all those evil sprintf and change them to
UT_snprintf.

But really maybe we should just refuse to support systems so brain dead
they don't have snprintf. They deserve to be hacked with buffer
over-run's.

In the meantime people who find no snprintf in sane locations should flame
their OS venders.

Cheers

Martin



This archive was generated by hypermail 2b25 : Tue Oct 23 2001 - 09:45:18 CDT