Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • What is the sense of having the string only inside the scope? After the close brace, it can not longer be used.
    – Klaus
    Commented May 10, 2020 at 7:18
  • 3
    I assumed that was the intention, otherwise why declare it inside the switch statement?
    – john
    Commented May 10, 2020 at 7:28
  • 3
    I guess it's worth to add a hint that variables should be declared in its most inner scope which just spans the intended life-time at best. In certain cases, it's even useful to add an extra scope for a well-defined life-time of a variable. (E.g. it's recommendable for lock guardians or other occurrences of RAII.) Commented May 10, 2020 at 7:46