On May 4, 2013, at 8:39 AM, "Vicente J. Botet Escriba"
Le 04/05/13 14:32, Rob Stewart a écrit :
On May 3, 2013, at 7:05 PM, "Vicente J. Botet Escriba"
wrote: Le 03/05/13 19:53, Howard Hinnant a écrit :
On May 3, 2013, at 1:46 PM, "Vicente J. Botet Escriba"
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? ___ Rob (Sent from my portable computation engine)