Boost logo

Boost Users :

From: Jeff Garland (jeff_at_[hidden])
Date: 2004-07-20 21:20:00


On Tue, 20 Jul 2004 21:45:19 -0400, Caleb Epstein wrote
> On Tue, 20 Jul 2004 17:20:45 -0400, David Abrahams
> <dave_at_[hidden]> wrote:
> > "Jeff Garland" <jeff_at_[hidden]> writes:
> >
> > > I've given in to user demand -- the default constructor to
> > > not_a_date_time will be in the 1.32 -- gregorian::date same story.
> >
> > Why was that the right choice? It seems like an opportunity for bugs.
>
> What would you propose as an alternative? I hope not the current
> system time, the acquisition of which can be a relatively expensive
> operation.

Oh my, never, no way. A certain famous vendor of C++ libraries made this
mistake. Needless to say, I was none to happy when my scheduling application
had to make 100K time values and we found we were burning all our time reading
the system clock to get a value that would be overwritten in a few
instructions. In a future version this company created a whole new time class
 and deprecating the original solution....

There's probably a design principle here like: value object constructors
shouldn't have expensive side effects like making system calls.

>I for one prefer the not_a_date_time option.

This should be about as expensive as

  boost::int64_t v = 0;

depending on how good your compiler is at munching template code ;-)

Jeff


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net