cplusplus / cplusplus/draft

[basic.scope.block] p1 The note should be as a normative rule

Open
#4,841 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

Each

  • selection or iteration statement ([stmt.select], [stmt.iter]),
  • substatement of such a statement,
  • handler ([except.pre]), or
  • compound statement ([stmt.block]) that is not the compound-statement of a handler

introduces a block scope that includes that statement or handler.

[Note 1: A substatement that is also a block has only one scope. — end note]

Isn't that note should be phrased as a normative rule? My proposal is that

Each

  • [...]
  • substatement of such a statement that is not a compound-statement,
  • [...]
  • compound statement ([stmt.block]) that is not the compound-statement of a handler

introduces a block scope that includes that statement or handler.

[Note 1: A substatement that is also a block has only one scope. — end note].

if(true) {
}

The substatement is a compound-statement, hence the second bullet does not apply but the last bullet does, which means the substatement only introduced one block scope.

Contributor guide

No contributing guide indexed for this repository

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 quoted [basic.scope.block] wording and the proposed change to the substatement bullet. Check how the example if(true) {} is covered by each bullet and whether the wording states the intended single-scope rule normatively. Done means the adopted wording is precise and consistent with the surrounding standard text.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.