isocpp / isocpp/CppCoreGuidelines

F.4 should only apply to libraries

Open
#1,697 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
CSS
Stars
45.3k
Forks
5.6k
PR merge metrics
No merged PRs in 30d

Description

F.4: If a function may have to be evaluated at compile time, declare it constexpr

Please don't. The compiler will tell you if and when you actually need to declare it constexpr. Instead of pondering and guessing about this ahead of time, and writing longer code for no reason, just add the keyword when needed.

The one exception to is libraries (of any form). Library interfaces need to be thought out ahead of time, because you don't want library users changing the code.

Contributor guide

Open the contributing guide

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.

Research direction

Start by locating guideline F.4 in the C++ Core Guidelines content and read its surrounding explanation. Update the rule so its applicability to libraries is explicit, while preserving the stated rationale; done means the guideline clearly distinguishes library interfaces from ordinary application code.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.