Data dodania Pytanie
2017-08-05 22:08 Unexpected senseless optimization tries of a simple for loop (in Visual C++ 2017) »
I was playing around with the Visual C++ 2017 compiler doing some tests on how to implement various things to get maximum performance from the code wh...
(0) odpowiedzi
2017-06-08 08:06 how to automate GUI tests of Legacy Rail road app MFC VC++ based wabtec »
I have a Legacy Windows app used by Rail road /Train customer developed by Wabtec electronics. It is supposed to use VC++ and MFC libraries. Attached ...
(0) odpowiedzi
2017-05-22 11:05 Can't assign string literal to boxed std::string vector »
This is a simplified version of my type system: #include <string> #include <vector> template<typename T> class Box { public: B...
(3) odpowiedzi
2017-05-20 12:05 How to change C++ standard library implementation in Visual Studio »
I would like change c++ standard library form microsoft to another which support c++17 standard. I mean swap vs lib with libstdc++ or libc++ Is is pos...
(1) odpowiedzi
2017-05-11 14:05 Deallocation of memory when argument subexpression of new expression throws »
Dynamic analysis discovered curious memory leak in our code-base. The code in question looks like: Something *p = new Something(getArgument()); whe...
(2) odpowiedzi
2017-04-23 22:04 C++ macro only works when preprocessed to a file »
I am trying to create a matching mechanism for the new std::optional<T> in C++. I've written the following macro: #define EXPAND(x) x #define C...
(1) odpowiedzi
2017-03-27 21:03 Error when returning reference to type given the expression: `cond ? *this : throw()` »
This appears to be an error, but I just want to confirm. Is the following well formed? If not, why not? #include <iostream> struct X { i...
(3) odpowiedzi
2017-03-19 13:03 Why does the compiler shift left by 0? »
After I wrote this simple program, when I went to the disassembly mode in Visual Studio I noticed something strange: the compiler added an instruction...
(1) odpowiedzi
2017-03-14 15:03 How can I override a class scoped `__declspec(dllexport)` annotation on a per-member basis? »
On ELF targets, if I have class Foo and I have given it default visibility via a declaration like class __attribute__((visibiility("default"))) Foo, I...
(1) odpowiedzi
2017-03-13 00:03 Is the Visual C++ implementation of std::async using a thread pool legal »
Visual C++ uses the Windows thread pool (Vista's CreateThreadpoolWork if available and QueueUserWorkItem if not) when calling std::async with std::lau...
(0) odpowiedzi
2017-03-05 16:03 Must constexpr expressions be captured by a lambda in C++? »
Here is a piece of code that won't compile in MSVC 2015 (ignore the uninitialized value access): #include <array> int main() { constexpr in...
(2) odpowiedzi
2017-02-27 17:02 `type *var = (int)0`, legal or not? »
The following example: char *var = (int)0; Compiles on gcc and cl.exe, but causes an error in clang: cannot initialize a variable of type 'char...
(1) odpowiedzi
2017-01-21 13:01 Dynamic allocation of class array with protected destructor »
If I have a class defined like class A { protected: ~A(){ } }; then I can dynamically allocate the individual as well as array of objects like ...
(3) odpowiedzi
2017-01-10 09:01 Evaluating stream operator >> as boolean »
The following code compiles in Visual Studio 2008 but fails in Visual Studio 2013 and later. std::string str("foo"); std::stringstream ss(str); float...
(1) odpowiedzi
2017-01-04 19:01 C++ Requesting MSVCP110D.dll even if static linked »
I created a dll injection method on my machine in C++ which works very well when I try to inject a specific dll into a game . However , when I run the...
(1) odpowiedzi
2016-12-22 13:12 Deleted constructor - MSVC reports an error, Clang doesn't »
Consider the following code: class SILPassPipelinePlan final { public: SILPassPipelinePlan() = default; ~SILPassPipelinePlan() = default; SILPa...
(2) odpowiedzi
2016-12-03 17:12 VC++ 15 calls the wrong copy constructor for lambda capture? »
Consider the following program: #include <iostream> struct X { X () = default; X (X &) { std::cout << "non-const called" <<...
(1) odpowiedzi
2016-11-29 14:11 Debugging in Visual Studio without Pdb files (C++ Access Voilation) »
I built OpenCV binaries(.dll) using Cmake & visual studio which generated .pdb file which helped me to find the issue in code (Partially!) How t...
(0) odpowiedzi
2016-11-17 16:11 cast operator function compiles fine in g++ but not in other compilers. Why? »
Consider following program: struct S { using T = float; operator T() { return 9.9f; } }; int main() { S m; S::T t = m; t = m.oper...
(1) odpowiedzi
2016-11-11 11:11 Call function based on template argument type »
There are two "C" functions: void fooA(const char*); void fooW(const wchar_t*); Then there is a wrapper template function: template<typename _...
(6) odpowiedzi
2016-10-14 20:10 What is the most suitable type of vector to keep the bytes of a file? »
What is the most suitable type of vector to keep the bytes of a file? I'm considering using the int type, because the bits "00000000" (1 byte) are in...
(3) odpowiedzi
2016-08-22 10:08 Warning when comparing references to bool and int with MSVC 2015 »
The following code produces a warning with MSVC (2015 Update 3) - with /W4: const bool& a = true; const int& b = 1; if(a == b) C4805: '==':...
(1) odpowiedzi
2016-08-15 18:08 visual c++ - why is reading a file with an unsigned char ifstream so much slower than using a char ifstream »
I've been testing out performance with reading files in C++ using Visual Studio, and I've got some results that I really don't understand. My code is...
(2) odpowiedzi
2016-08-04 14:08 Visual Studio C++ compiler generates 3x slower code when changing completely unrelated code »
I have a nested for loop which generates the following assembly: # branch target labels manually added for readability 002E20F8 mov ebx,esi ...
(1) odpowiedzi
2016-07-28 14:07 Is 'default' a context specific keyword in MSVC 2015? »
Why does following code compiles successfully on MSVC 2015 (Update 3), and also on VC++ Compiler online? int main() { int default = 10; cout...
(0) odpowiedzi
2016-07-27 15:07 range based for loop with existing variable »
Using a range based for loop in C++11 with an existing variable, I would expect that variable to be filled with the value of the last iteration after ...
(4) odpowiedzi
2016-07-08 23:07 MSVC brace initialization with doubles appears to violate the standard? »
Check out this simple program: int main() { float f2 = 7.2; // OK, with warning float f3 = 7.199999809265137; // OK, no warning float f4{...
(1) odpowiedzi
2016-07-07 18:07 Optimization barrier for microbenchmarks in MSVC: tell the optimizer you clobber memory? »
Chandler Carruth introduced two functions in his CppCon2015 talk that can be used to do some fine-grained inhibition of the optimizer. They are useful...
(2) odpowiedzi
2016-06-29 17:06 Why does the compiler complain about this not being a constexpr? »
I am trying to learn a bit more on how to use C++ constant expressions in practice and created the following Matrix class template for illustration pu...
(1) odpowiedzi
2016-06-29 08:06 Convert long to wchar_t * »
thanks for reading. I think I'm close on this one, but I could use some expertise on understanding why my attempt at something is not performing the ...
(1) odpowiedzi
2016-06-11 20:06 No access or ambiguity check on templated member function found in multiple base classes »
This compiles and runs fine on Visual C++ 2015 Update 3 RC: class A { template <class T> void f() {} }; class B : A {}; class C : A {}; c...
(1) odpowiedzi
2016-04-22 08:04 Force C++ program to pause in Visual Studio debugger »
I'm debugging C++ program compiled with MSVC under Windows. I want to investigate issue linked with multi threading. So I put ASSERT in my code and wh...
(2) odpowiedzi
2016-04-15 23:04 C++ multiple versions of a defaulted special member functions -- error in MSVC 2015 »
The following simple code produces an error in the newest Visual Studio compiler (MSVC 2015 Update 2): struct Foo { template<typename ... Args...
(1) odpowiedzi
2016-04-08 11:04 Why does the statement “cout << '\\\\';” not fail? »
The source code is as the following. cout << '\\' << endl; //OK, output is \ cout << '\\\\' << endl; //OK, output is an...
(1) odpowiedzi
2016-04-01 15:04 maximum of 3 values, performance of left-associative version vs. right-associative version »
The following code shows a big performance difference of the two versions of min_3 on my machine (Windows 7, VC++ 2015, release). #include <algori...
(3) odpowiedzi