4 ms·
What confused me in their wording is that they seem to imply that the problem is: b would be left uninitialized, rather than: a depends on uninitialized b. Your
by BruceEel 4y ago
What confused me in their wording is that they seem to imply that the problem is: b would be left uninitialized, rather than: a depends on uninitialized b.
Your explanation, OTOH, is straightforward to read.
- dundarious 4y agoUnderstandable. The original is correct that b is used uninitialized, but they don't clarify that it is a that is left uninitialized.
- tialaramex 4y agoMmm? The consequence of reading the uninitialized variable is that your program's behaviour is Undefined. There's no point worrying about this other variable named 'a', it's already game over. It's not called "Temporarily unusual" behaviour or "Reliably crashing" behaviour or even "I bet it'll probably just skip that and do the next thing" behaviour, it's Undefined for a reason.
- dundarious 4y agoThe distinction is helpful so that people properly understand what's going on with and what's wrong with the code in question (the context is helping someone who did not fully understand). You're talking about the consequences in terms of compiler output and code execution, and yes, the usage is the problem.