Skip to content

Replace the uses of "local variable" with "[block] variable with automatic storage duration" #7307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

frederick-vs-ja
Copy link
Contributor

@frederick-vs-ja frederick-vs-ja commented Oct 16, 2024

P1787R6 dropped the previous buggy uses and definition of term local variable. But there're many remaining use of local variable.

This PR removes the remaining occurences except for one "conceptual local variable" in a comment (which seems OK to me as we're not talking about real local variable).

Fixes #6617.

@jensmaurer
Copy link
Member

I would prefer to replace the remaining uses of "local variable" with "[block] variable with automatic storage duration" for consistency, instead of reintroducing a term that CWG agreed to abolish.

@frederick-vs-ja frederick-vs-ja changed the title [basic.scope.block] Reintroduce local variable Remove occurences of "local variable" Oct 16, 2024
@frederick-vs-ja frederick-vs-ja changed the title Remove occurences of "local variable" Replace the uses of "local variable" with "[block] variable with automatic storage duration" Oct 16, 2024
@frederick-vs-ja
Copy link
Contributor Author

I would prefer to replace the remaining uses of "local variable" with "[block] variable with automatic storage duration" for consistency, instead of reintroducing a term that CWG agreed to abolish.

Thanks. I'm now switching to this direction.

@FrankHB
Copy link
Contributor

FrankHB commented Oct 16, 2024

I would prefer to replace the remaining uses of "local variable" with "[block] variable with automatic storage duration" for consistency, instead of reintroducing a term that CWG agreed to abolish.

They are not equivalent. The term "local variable" has nothing to do with the storage duration at all, it is now just "block variable", not necessarily "with automatic storage duration"; although most use cases apparently imply this. And personally I don't like too many occurence of the lengthy "with automatic storage duration" phrase when the storage duration is contextually clear enough.

@jensmaurer
Copy link
Member

@FrankHB , works for me; I haven't looked at the details. If we mean "block variable", we should say so. If we mean "with automatic storage duration", we also should say so.

Replace the uses of "local variable" with "[block] variable with
automatic storage duration". Sometimes the automatic storage duration"
can be inferred from the context.
@frederick-vs-ja
Copy link
Contributor Author

And personally I don't like too many occurence of the lengthy "with automatic storage duration" phrase when the storage duration is contextually clear enough.

Yeah. I wish it's clear enough to suppose the automatic storage duration can be implied by not using static or thread_local in the library wording.

- Use "initializes variables with automatic storage duration" in [text].
- Drop some adjectives in [except.ctor].
@tkoeppe
Copy link
Contributor

tkoeppe commented Jun 27, 2025

Looks good, thanks! @jwakely could you have a quick look at the iostreams wording?

Copy link
Member

@jwakely jwakely left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being this precise about the storage duration of hypothetical local variables used within locale facets seems unnecessary to me (is anybody going to interpret that wording as saying they should have static storage duration?!), but whatever, it's fine.

@tkoeppe
Copy link
Contributor

tkoeppe commented Jun 27, 2025

Well, the main point is to get rid of the term "local". The proposed wording avoids any future complaints about potential ambiguity. In the non-normative examples we have indeed just dropped all qualifications, since it's clear from context what we mean, but in the normative wording it's perhaps worth being precise even if it's obvious.

@jwakely
Copy link
Member

jwakely commented Jun 27, 2025

Understood, I just think using "variables" in the locale wording would have been fine. That wording has bigger problems!

@jwakely
Copy link
Member

jwakely commented Jun 27, 2025

But I'm not suggesting a change - as you say, being explicit avoids potential future requests for clarification.

@tkoeppe
Copy link
Contributor

tkoeppe commented Jun 27, 2025

Right... if you think the wording would be completely fine and beyond future reproach, I'd be happy to consider dropping the qualifications, but spelling it out seems a bit safer, since it would otherwise be open to questions (e.g. "Can the sentry be static? That's faster.").

@tkoeppe
Copy link
Contributor

tkoeppe commented Jun 27, 2025

@frederick-vs-ja: would you mind digging up the affected subclause stable labels?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[basic.scope.block] et al. - Ambiguous definition of "local variable"
5 participants