From: Jeff Garland (jeff_at_[hidden])
Date: 2005-06-24 20:50:48
On Thu, 23 Jun 2005 13:06:30 +0000 (UTC), Martin wrote
> 1. The date_time library in the currenct CVS doesn't follow the
> standard formatted input/output requirements in the C++ standard.
> stringstream s("205-Jan-01");
> date d;
> s >> d;
> will throw "Year out of valid range" exception instead of just
> setting the badbit.
True -- should fix that.
> 2. The default date format is "%Y-%b-%d" which is very confusing
> since it is using a date order that is not common in english
> speaking countries while it uses english month names. The default
> format should be "%x".
I understand your point of view, but my priority is to be backward compatible
with the 1.32 date-time release. In addition, %x uses 2 digit years in the
standard C locale -- this is a huge problem. When I wrote the very first
operator<< for date-time I very specifically choose the current form because
it is logical and clear. It uses iso ordering -- largest to smallest element.
The short month names ensure there can be no confusion about what element is
the month and which is the day. No english speaking person I've met (and I'll
bet alot of non-english speakers) has trouble figuring out this date:
but lots of people are potentially confused by:
and it becomes utterly hopeless with:
> (I know this will create problems with input parsing on some STL
> libraries but I think it is a better than the current solution where
> almost nobody can use the default).
People have been using this default up till now. And frankly all defaults are
questionable anyway because most of the real-world apps I've seen end up with
a small handful of formats they need to support.
> 3. The streaming functions all add a new facet to the locale if no
> current facet has been imbued. Wouldn't it be better to either have
> a singleton "default" facet for all streams or imbue the facet to
> the global locale instead?
As to the singleton -- well it raises all sorts of possible lifecycle
problems. Basically the current scheme optimizes for the case where a stream
is used repeatedly and works even if you aren't using the global locale.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk