Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 Add initialization to uninitialized variables

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
kenny Posted - Oct 28 2018 : 9:32:05 PM
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.
1   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Oct 29 2018 : 1:33:38 PM
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?

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000