Three syntaxes for initialising auto-typed variables#2618
Conversation
The initialisation expression can be an assignment but that means `a = b = 0`. The initialisation expression can involve `operator new` but it is not a separate case. Compare `auto a = new int;` and `auto a (new int);`. There is no initialisation statement inherently involving `operator new` (unlike in Visual Basic). The fact that a `for` loop involves an initialisation statement is a side note at best. This trivia fact is not specific to `auto`. The parenthesised "explanations" explained one unknown with another unknown. I replaced them with short examples.
|
@yecril71pl : Thanks for your contribution! The author(s) have been notified to review your proposed change. |
|
@yecril71pl |
According to the maintainer’s comments.
|
@yecril71pl : Thanks for your contribution! The author(s) have been notified to review your proposed change. |
I formally disagree but I have restored it since it is a typical use case. You may have to adapt the terminology though. Have a nice holiday! :-) |
It seemed to call out for a list, since the sentence was getting complicated.
|
@corob-msft : Thanks for your contribution! The author(s) have been notified to review your proposed change. |
colin-home
left a comment
There was a problem hiding this comment.
@yecril71pl
Thanks for your patience. I appreciate your contribution, even though I've substantially rewritten it to make our grammar checker happy. I'll merge this version. You're welcome to submit additional changes as PRs if you think more clarity is needed.
The initialisation expression can be an assignment but that means
a = b = 0.The initialisation expression can involve
operator newbut it is not a separate case. Compareauto a = new int;andauto a (new int);. There is no initialisation statement inherently involvingoperator new(unlike in Visual Basic).The fact that a
forloop involves an initialisation statement is a side note at best. This trivia fact is not specific toauto.The parenthesised "explanations" explained one unknown with another unknown. I replaced them with short examples.