Variable declared inside a for loop. How do I make this to a compile time error?

后端 未结 3 1850
南方客
南方客 2020-12-16 03:04

Today I investigated a logical bug in our software and figured out that this is related to the way VB.NET thread variables inside a loop.

Let\'s say I have the follo

3条回答
  •  悲&欢浪女
    2020-12-16 03:38

    If you think this may be a problem with your codebase or your programmers, in your coding style specify that all uninitialised variables are declared at the start of the routine. This had been a common style guideline (especially for VB) until the prevalence of type inference.

    Of course it doesn't avoid the problem, just makes it more obvious.

提交回复
热议问题