Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Add initialization to uninitialized variables
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kenny
Junior Member

19 Posts

Posted - Oct 28 2018 :  9:32:05 PM  Show Profile  Reply with Quote
The compiler complains about using uninitialized variables with warnings like this:
warning C4701: potentially uninitialized local variable 'XX' used

It would be nice if VA can provide refactoring command to automatically add initialization code to the declaration statements based on selection of code, multiple statements/lines would be preferable.

feline
Whole Tomato Software

United Kingdom
18755 Posts

Posted - Oct 29 2018 :  1:33:38 PM  Show Profile  Reply with Quote
A similar idea has come up for creating default class constructors. The problem is, what do you initialise the variables with? If you are looking at simple built in types then this is one thing, but what about complex data types? Where do the default values come from?

It's not a bad idea, but we would need a plan to consider doing this.

Or are you talking about selecting the default value that the variable should be initialised with? You cannot select the line that generates the warning, since that is not an assignment line, so what if there is no near by code that is good for setting the default value?

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000