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
 VAX auto-complete messes up std::string::c_str()
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

pbrown
Senior Member

USA
44 Posts

Posted - Jul 23 2021 :  10:14:21 PM  Show Profile  Reply with Quote
I have some code where I'm using std::string to build up strings that I then need to pass to C code. To do this, I'm trying to use the c_str() method of std::string.

However, VAX's auto-completion logic keeps trying to turn:

std::string var = "Hello";
var.c_str()

into something like:

var.~basic_string()

When I look at the definition for c_str() in the Microsoft headers, I see:

    _NODISCARD _Ret_z_ const _Elem* c_str() const noexcept {
        return _Mypair._Myval2._Myptr();
    }

The "_NODISCARD" part seems to be confusing VAX. I worked around this by adding:

#define _NODISCARD

to my va_stdafx.h file.

Particulars:
VA_X.dll file version 10.9.2406.0 built 2021.04.23
DevEnv.exe version 16.9.31105.61 Professional

feline
Whole Tomato Software

United Kingdom
18746 Posts

Posted - Jul 26 2021 :  06:59:04 AM  Show Profile  Reply with Quote
Thank you for the bug report and your logical work around. So far I cannot reproduce the problem here though, and I have just checked two different VS2019 solutions, in case there is something odd about my default test solution.

In Solution Explorer, if you right click on your C++ project, go to Properties, and look at General settings, what to you have your Platform Toolset set to?

I am assuming this is "Visual Studio 2019 (v142)" but it might well be something else.

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