Timeline for Jump bypasses variable initialization in switch statement
Current License: CC BY-SA 4.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 10, 2020 at 7:46 | comment | added | Scheff's Cat | 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.) | |
May 10, 2020 at 7:28 | comment | added | john | I assumed that was the intention, otherwise why declare it inside the switch statement? | |
May 10, 2020 at 7:18 | comment | added | Klaus | What is the sense of having the string only inside the scope? After the close brace, it can not longer be used. | |
May 10, 2020 at 7:06 | history | answered | john | CC BY-SA 4.0 |