Skip to content
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

[stmt.dcl] p3 Improve the contradictory wording #5503

Open
xmh0511 opened this issue Jun 2, 2022 · 0 comments
Open

[stmt.dcl] p3 Improve the contradictory wording #5503

xmh0511 opened this issue Jun 2, 2022 · 0 comments

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Jun 2, 2022

[stmt.dcl] p3 says

Dynamic initialization of a block variable with static storage duration or thread storage duration is performed the first time control passes through its declaration; such a variable is considered initialized upon the completion of its initialization. If the initialization exits by throwing an exception, the initialization is not complete, so it will be tried again the next time control enters the declaration.

Presumably, once the initialization of such a variable is complete, the variable will not be initialized even though the control passes through its declaration. However, this meaning is not clear in the current wording. Moreover, the next time control(i.e. not the first time) case contradicts "the first time control passes". It reads not nature since we rigidly redefine the re-enter case(i.e. the initialization is not complete). The suggestion might be:

Dynamic initialization of a block variable with static storage duration or thread storage duration is performed if the first time control passes through its declaration and either

  • the variable has not been yet initialized, or
  • its initialization is not complete

such a variable is considered initialized upon the completion of its initialization. If the initialization exits by throwing an exception, the initialization is not complete.

[note: so the initialization will be tried again the next time control enters the declaration — end note]

This might be clearer.

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

No branches or pull requests

1 participant