Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Code Inspection: "auto" Quick Fix problem with *

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
drzoom Posted - Jun 02 2017 : 05:24:27 AM
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.
3   L A T E S T    R E P L I E S    (Newest First)
sean Posted - Sep 26 2017 : 10:56:39 PM
case=108642 is implemented in build 2235
holedigger Posted - Jun 02 2017 : 1:02:35 PM
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)
feline Posted - Jun 02 2017 : 12:04:35 PM
That is fair, and a little unexpected, I have put in a bug report for this:

case=108642

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