isocpp / isocpp/CppCoreGuidelines

Guideline against unconventional overloads

Open
#2,118 2 comments 1 reaction 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

Should there be a guideline recommending against overloading operators that people almost never anticipate to be overloaded? This would include things like:

  • overloading the comma operator
  • overloading logical AND and logical OR

There is fairly strong consensus in the community that doing so is questionable at best, and afaik standard libraries aren't all comma-safe either.

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 reviewing the existing operator-overloading guidance in the C++ Core Guidelines and the issue's examples of comma, logical AND, and logical OR overloads. Done means reaching agreement on whether a rule is warranted, its scope, and wording; the issue has no named file or test to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.