3 ms·
No, it can't. His example doesn't even contain "int i = 0". He has "int i;" followed later by an initializer that can be skipped depending on the rather funky s
by kstenerud 4y ago
No, it can't. His example doesn't even contain "int i = 0". He has "int i;" followed later by an initializer that can be skipped depending on the rather funky switch logic he's added (i.e. it's undefined behavior).
Nothing to see here. Clickbait title.
- quelsolaar 4y agoMaybe other readers will be able to see that the example includes many different tests when things are declared and not initialized. The goto example specifically contains int i = 0, but users are less likely to run in to that one since it is goto. Using an uninitialized variable is Undefined behaviour. Thats the point.