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
 Technical Support
 Code Inspection: "auto" Quick Fix problem with *
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

drzoom
Ketchup Master

Switzerland
57 Posts

Posted - Jun 02 2017 :  05:24:27 AM  Show Profile  Reply with Quote
The new Code Inspection feature is great!

I found a minor bug with the quick fix for "auto":
LPWSTR* strAttributes = (LPWSTR*)(AllocADsMem(sizeof(LPWSTR)*numAttributes));

is fixed like this:
auto* strAttributes = (LPWSTR*)(AllocADsMem(sizeof(LPWSTR)*numAttributes));

Obviously, the * should be part of the replacement as well.

best regards
Tobias

feline
Whole Tomato Software

United Kingdom
16086 Posts

Posted - Jun 02 2017 :  12:04:35 PM  Show Profile  Reply with Quote
That is fair, and a little unexpected, I have put in a bug report for this:

case=108642

zen is the art of being at one with the two'ness
Go to Top of Page

holedigger
Whole Tomato Software

145 Posts

Posted - Jun 02 2017 :  1:02:35 PM  Show Profile  Reply with Quote
They are equivalent, with or without the *. I believe it is a matter of preference, as I couldn't find a recommendation in the C++ Core Guidelines. Some people prefer the * with auto because you explicitly know it is a pointer and that you're not accidentally copying an object.


auto obj1 = Fn1();
auto obj2 = obj1; // this might be a copy, can't tell from code

auto *obj3 = Fn2();
auto *obj4 = obj3; // not a copy


This is configurable in Visual Assist, but there is currently no UI for doing it -- you need to use edit the registry.
Close all instances of Visual Studio, then use regedit to find key:
HKEY_CURRENT_USER\Software\Whole Tomato\Visual Assist X\VANet{IDE_VER}\CodeInspections
Find the value for CheckerOptions and add ";modernize-use-auto.RemoveStars=1" (it is a ';'-deliminated list of options)

Whole Tomato Software
Go to Top of Page

sean
Whole Tomato Software

USA
2698 Posts

Posted - Sep 26 2017 :  10:56:39 PM  Show Profile  Reply with Quote
case=108642 is implemented in build 2235
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2019 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000