microsoft / microsoft/terminal
Code Health: Consider disabling warning C26440
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 105k
- Forks
- 9.6k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 29
Description
In one of the PRs I'm working on, I found I was getting errors from the audit mode build because it wanted me to declare certain methods as noexcept (warning C26440). But the methods in question were calling the std:array::at method, which throws an exception, so I would have thought they couldn't be noexcept.
You can see an example of this in the TerminalSettings::GetColorTableEntry method:
It's calling std:array::at, so it clearly can throw an exception, but it's still declared as noexcept. And removing that noexcept will trigger above-mentioned error in the audit mode build.
So what is the recommended practice here? Do we just add noexcept to the method even though that's not actually true? Do we suppress the warning on a case by case basis? (Per function, or per compilation unit?) Or should we consider disabling the warning for the entire project, at least until it's more reliable?
Contributor guide
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 TerminalSettings::GetColorTableEntry in src/cascadia/TerminalSettings/TerminalSettings.cpp and review how audit mode reports warning C26440. Compare the noexcept behavior of std::array::at with the project's warning configuration, then determine whether the warning should be suppressed locally or project-wide; done means a documented, agreed recommendation or configuration change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100