visual-c++

Why does std::stof not throw when passed an argument it cannot convert?

六月ゝ 毕业季﹏ 提交于 2021-02-07 18:22:33
问题 I'm working on a project where I want to accept an input of the form {float}{single-letter-identifier} , for example 15.6E , or 10W . To do this, I thought that I could take the input string, strip off the last letter and then check to see if a conversion could be performed to float, using std::stof . This would be nested in a try-catch block, and allow me to notify the user of invalid input. The open-standard of the STL here (page 653) states that std::stof throws: invalid_argument if wcstod

Why does std::stof not throw when passed an argument it cannot convert?

眉间皱痕 提交于 2021-02-07 18:21:05
问题 I'm working on a project where I want to accept an input of the form {float}{single-letter-identifier} , for example 15.6E , or 10W . To do this, I thought that I could take the input string, strip off the last letter and then check to see if a conversion could be performed to float, using std::stof . This would be nested in a try-catch block, and allow me to notify the user of invalid input. The open-standard of the STL here (page 653) states that std::stof throws: invalid_argument if wcstod

How to determine at runtime when your C++ application has the visual studio debugger attached?

我的未来我决定 提交于 2021-02-07 14:28:34
问题 How do you determine at runtime whether the visual studio debugger is attached to your process. I've seen instructions for how to do this in .NET, but my process is a native C++ process. Support for detecting Just-in-time debugging would be nice but not a strict requirement. 回答1: The Win32 call IsDebuggerPresent() sounds like it ought to work. 回答2: Use IsDebuggerPresent 来源: https://stackoverflow.com/questions/2789390/how-to-determine-at-runtime-when-your-c-application-has-the-visual-studio

Difference between COM and DCOM?

依然范特西╮ 提交于 2021-02-07 13:46:45
问题 What is the difference between COM and DCOM ? 回答1: DCOM stands for "Distributed COM". That means the client and server can be on different machines communicating across the network, instead of both being on the same machine as in conventional COM. 回答2: DCOM=Distributed Component Object Model, you might call it COM via RPC. DCOM – Wikipedia 回答3: COM stands for Component Object Model . DCOM stands for Distributed Component Object Model . COM is set of component tools which are executed client

Difference between COM and DCOM?

偶尔善良 提交于 2021-02-07 13:45:08
问题 What is the difference between COM and DCOM ? 回答1: DCOM stands for "Distributed COM". That means the client and server can be on different machines communicating across the network, instead of both being on the same machine as in conventional COM. 回答2: DCOM=Distributed Component Object Model, you might call it COM via RPC. DCOM – Wikipedia 回答3: COM stands for Component Object Model . DCOM stands for Distributed Component Object Model . COM is set of component tools which are executed client

Getting the caller's Return Address

我们两清 提交于 2021-02-07 13:37:44
问题 I am trying to figure out how to grab the return address of a caller in MSVC. I can use _ReturnAddress() to get the return address of my function, but I can't seem to find a way to get the caller's. I've tried using CaptureStackBackTrace, but for some reason, it crashes after many, many calls. I would also prefer a solution via inline assembly. void my_function(){ cout << "return address of caller_function: " << [GET CALLER'S RETURN VALUE]; } // imaginary return address: 0x15AF7C0 void caller

Passing bytes by reference from C# into C++/CLI wrapper to call the InterlockedOr8 function

白昼怎懂夜的黑 提交于 2021-02-07 10:54:47
问题 I am trying to pass bytes by reference from C# such that I can call the atomic operation InterlockedOr8 on them. I have the following static library in C++: Bitwise.h : char EightBitOr(char volatile* destination, char value); Bitwise.cpp : #include "Bitwise.h" char EightBitOr(char volatile* destination, char value) { return InterlockedOr8(destination, value); } I am calling it from this C++/CLI wrapper DLL: Wrapper.h : #include "..\Bitwise\Bitwise.h" using namespace System; namespace Wrapper

Passing bytes by reference from C# into C++/CLI wrapper to call the InterlockedOr8 function

空扰寡人 提交于 2021-02-07 10:54:32
问题 I am trying to pass bytes by reference from C# such that I can call the atomic operation InterlockedOr8 on them. I have the following static library in C++: Bitwise.h : char EightBitOr(char volatile* destination, char value); Bitwise.cpp : #include "Bitwise.h" char EightBitOr(char volatile* destination, char value) { return InterlockedOr8(destination, value); } I am calling it from this C++/CLI wrapper DLL: Wrapper.h : #include "..\Bitwise\Bitwise.h" using namespace System; namespace Wrapper

Different behaviour between CString operators “+=” and “+”

眉间皱痕 提交于 2021-02-07 06:51:22
问题 While migrating an application from VisualStudio 2005 to VisualStudio 2015 we found a different behaviour in some code that concatenates CString instances when that code is built with VS2015. So, I've created a simple Win32 console application to demonstrate the problem. The console application (using MFC as shared dll and Unicode charachter set) executes this simple function: void f() { CString x( '\0' ); CString r( 'a' ); r += x; CString rr( 'a' ); rr = rr + x; int rSize = r.GetLength();

Where are the MSM files for the Visual C++ redistributable for Visual Studio 2017?

℡╲_俬逩灬. 提交于 2021-02-07 06:27:05
问题 I've been using VS 2015 for a while now and just upgraded to VS 2017 when it launched yesterday (2017-03-07). I installed with only the .NET desktop and C++ desktop workflows, without changing any other individual components. I'm considering migrating my C++ projects to the 2017 toolchain (version "141" apparently? 2015 was "140"). I need to use the VC merge modules for my installer, so I looked in the C:\Program Files (x86)\Common Files\Merge Modules folder, but that folder only contains