date
date copied to clipboard
Quick question about casting day, month and year
Quick question:
Might you tell me the reasoning behind day
and month
types being cast to unsigned
, while year
types are cast to int
?
Thanks in advance.
The rationale was simply to enforce that negative integral values for month
are never represented (ditto for day
), while they are for year
. It was realized that this design choice had a small cost in terms of homogeneity. And that was weighed against the small benefit of enforcing lack of negative values for month
and day
. I recognized this as a small-cost / small-benefit design decision and landed with where it is today.