Boost logo

Boost :

Subject: Re: [boost] [chrono][system] Make possible to don't provide hybrid error handling.
From: Beman Dawes (bdawes_at_[hidden])
Date: 2011-10-08 08:01:02


On Sat, Oct 8, 2011 at 7:08 AM, Vicente J. Botet Escriba
<vicente.botet_at_[hidden]> wrote:

... Discussion of alternatives ...

> I see  three alternatives:
>
> A- Standard
> Clock::now() noexcept;
>
> B- Standard+Hybrid
> Clock::now() noexcept;
> Clock::now(system::error_code&); // takes care of boost::throw()
>
> C-Standard+EC+TOE
> Clock::now() noexcept;
> Clock::now(system::error_code&) noexcept;
> Clock::now(throw_on_error_t&);
> ...
> Which way do you prefer? What do you think?

D - Standard with additional behavior:

* Return a special time_point value when an error occurs. Do this by
having time_point provide "static constexpr time_point error();" in
addition to min() and max(). Add something like this to the docs:
"Since most programs will run in only in environments where clocks
never fail, most programmers can safely ignore the possibility of this
value being returned." (You might consider on Windows doing a
fall-back if the Win32 high resolution timer fails, by the way.)

* At compile time, detect platforms (such as tiny embedded systems)
that never support the Clock, and issue an #error. Perhaps folks on
the list could help identifying such systems. They are probably rare.

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk