Core guideline: Use constexpr for values that can be computed at compile time

Open
#237 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
38/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
backend

Research direction

Locate str_from_delimited_time_duration() and counted_time_rep<>: the issue identifies both as sources of Visual C++ warning C26498. Update the relevant values as indicated by the warning, then verify with Visual C++ 2022 and the Microsoft Recommended Native Recommended Rules that the warnings disappear without changing constexpr behavior.

Written by the indexing model from the issue text.

Description

Commit 4e1b7cde45ed introduced constexpr functions.

A code analysis with Visual C++ 2022 and the Microsoft Recommended Native Recommended Rules spits out the warning "con.5" from the category "Constants and immutability" in str_from_delimited_time_duration() and counted_time_rep<>::frac_sec_per_day():

warning C26498: The function 'function' is constexpr, mark variable 'variable' constexpr if compile-time evaluation is desired (con.5).

Correcting this warning has no effect on the constexpressivity, but it would be nice if these warnings disappeared.

Dominant language
C++
Stars
70
Forks
99
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/date_time

All issues in boostorg/date_time

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.