`<bitset>`: `operator[]` could be SAL annotated with `_In_range_(<, _Bits)`
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 1.7k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 22
Description
Following array's example:
https://github.com/microsoft/STL/blob/2314e1a795ad632f7b19bb42437647590b564d36/stl/inc/array#L533
Found while investigating STL Hardening (#5090). I'm filing a followup issue because libcxx has tests under std/utilities/template.bitset that will emit /analyze warnings for bitset<0>. if constexpr could avoid this, but they compile their tests in older Standard modes.
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 the linked stl/inc/array operator[] example and compare it with bitset's operator[] implementation. Review the libcxx tests under std/utilities/template.bitset, especially the bitset<0> case, and use /analyze to verify that the SAL annotation prevents the reported warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100