isocpp / isocpp/CppCoreGuidelines

Flagging all uses of static downcasts seems overly draconian, and produces false positives.

Open
#83 13 comments 0 reactions 1 assignee View on GitHub

@hsutter is already working on this.

Since Dec 21, 2015.

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

Description

In its enforcement,
C.146: Use dynamic_cast where class hierarchy navigation is unavoidable
states
"Enforcement: Flag all uses of static_cast for downcasts, including C-style casts that perform a static_cast."

What about static downcasts that are on the scale between almost-always-safe to guaranteed-to-be-safe?
I'm specifically talking about CRTP base templates. The enforcement of this rule is a false positive
there.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.