Wouldn't the compiler be smart with this shadowing variable?

Matheus matheus at gmail.com
Sat Dec 11 15:12:17 UTC 2021


On Friday, 10 December 2021 at 21:55:17 UTC, Siarhei Siamashka 
wrote:
> ...
>    2. reuse the existing "j" variable.

Yes.

> But only one of them is a correct description of what actually 
> happens when the compiler processes this code. So it's a good 
> thing that the compiler is smart enough to reject ambiguous 
> code and prevent humans from making mistakes.

Hmm I see your point. And I just thought in cases like this the 
reuse should be the way, but I can see that this is a small 
snippet and in a big code this may hurt someone.

Matheus.


More information about the Digitalmars-d-learn mailing list