I've just spent the last day debugging something in which I ultimately ended up on an offending line. The path to this line wasn't exactly clear, and there was a slo-mo face palm once I spotted it...
int v = func(&v); // why am I allowed to do this.
Should this not generate some sort of 'var used before defined' warning? It was incredibly annoying because there was no compiler error or warning? and of course, no red suiggly line under the syntax :(. So I skipped right over it...
oddly, it worked in most cases until it was spotted.. lucky with the UB I guess?
Admitedly, my knowledge of compiler intricacies isn't great, so I am probably missing something obvious, but it looks to me like I just used a var before defining it, it could be argued I used it before declaring it!
Why is this valid C++ syntax?