microsoft / microsoft/STL

`<bitset>`: `operator[]` could be SAL annotated with `_In_range_(<, _Bits)`

Open
#5,262 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.