Subject: Re: [boost] [gsoc 2013] draft proposal for chrono::date
From: Rob Stewart (robertstewart_at_[hidden])
Date: 2013-05-04 09:29:45
On May 4, 2013, at 8:39 AM, "Vicente J. Botet Escriba" <vicente.botet_at_[hidden]> wrote:
> Le 04/05/13 14:32, Rob Stewart a Ã©crit :
>> On May 3, 2013, at 7:05 PM, "Vicente J. Botet Escriba" <vicente.botet_at_[hidden]> wrote:
>>> Le 03/05/13 19:53, Howard Hinnant a Ã©crit :
>>>> On May 3, 2013, at 1:46 PM, "Vicente J. Botet Escriba" <vicente.botet_at_[hidden]> wrote:
>>> The UB is when you need to build a date if the day is not on the range. E.g. the implementation could use some arrays indexed with the day and access memory that has no sense.
>>> If we are sure that a day is in the range 1..31, this kind of assumptions can be done on the implementation. The implementation could not do it if the day value has not been validated previously or behavior would be undefined.
>> You can apply the same range checking in the date constructor as you intended for the day, month, and year constructors. There is no difference in performance, since the same checking is done.
> Yes, there is one. When using constant/constexpr objects there is no need to validate at runtime its validity, they are valid by definition at compile time.
OK, but is that level of performance worth worrying about?
(Sent from my portable computation engine)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk