[time.cal] improve `std::chrono::month` `operator+`'s description of arithmetic mod 12
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
Perhaps we could just say:
Returns: a month with m_ equal to the sum of unsigned{x} and y.count(), reduced modulo 12 to an integer in [1, 12].
or something like that, rather than defining an auxiliary modulo(n, 12) function and going on an excursion to a definition of Euclidean division.
One problem: this is not entirely editorial, as the new wording does not admit any undefined behavior, whereas the description in the existing wording results in UB when long long and months' representation type are the same size and the months value is nearly LLONG_MAX. The undefined behavior here does not appear to be especially useful; implementations can easily produce the correct result by reducing the months value modulo 12 first, if they chose a representation type for months that is the same size as long long.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the existing specification wording for std::chrono::month operator+ and its auxiliary modulo(n, 12) definition in the draft sources. Compare the proposed direct wording and check the edge case involving a months representation near LLONG_MAX. Done means the arithmetic is described clearly without the unnecessary excursion or undefined behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, tex
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100