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 11, 2020 at 3:16 | vote | accept | Arun Suryan | ||
May 10, 2020 at 7:36 | comment | added | yeputons |
This is a small example. It is not used in the original code as well. But one can do all the processing needed for choice == 2 inside the switch statement: calling functions, pushing str to vector s, etc. If you need to access str strictly after the switch statement, it's a smell: there are no guarantees that str will have a reasonable value after the switch in general.
|
|
May 10, 2020 at 7:17 | comment | added | Klaus |
str can not be used after the close brace of the scope. What is the sense to enter a string and it can not longer be used?
|
|
May 10, 2020 at 7:06 | history | answered | yeputons | CC BY-SA 4.0 |