Data dodania Pytanie
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
2016-02-28 14:02 How to write a Postgres language handler using MSVC »
Here is the code, straight out of the sample. 64 bit install, x64 build. #include "postgres.h" #include "executor/spi.h" #include "commands/trigger.h...
(1) odpowiedzi
2016-02-12 23:02 operator[] lookup into template base classes »
The following code is causing a little headache for us: clang and MSVC accepts the following code, while GCC rejects it. We believe GCC is right this ...
(1) odpowiedzi
2016-02-03 12:02 Why does Microsoft std::vector::insert use rotate()? »
I was doing some experiments with lists vs vectors, and I noticed that the Microsoft implementation of std::vector is doing the following for .insert:...
(1) odpowiedzi
2015-11-21 03:11 Inserting to std::unordered_map calls hash function twice in MSVC++'s STL, bad design or special reason? »
For this code: #include<unordered_map> #include<iostream> using namespace std; struct myhash { unsigned operator()(const unsigned&amp...
(2) odpowiedzi
2015-11-13 17:11 Visual C++ arithmetic with `const` slower than regular variable »
So I was messing with Visual C++ 2015, and I noticed that there's an issue with the way Visual C++ seems to compile constants and the accessing of the...
(0) odpowiedzi
2015-10-26 12:10 Does RVO work on object members? »
Consider the following: struct A { /* ... */ }; A foo() { auto p = std::make_pair(A{}, 2); // ... do something return p.first; } auto a = foo...
(4) odpowiedzi
2015-10-18 05:10 Why does using an 'if' statement give me better performance? »
When compiling the following program in VC++2015 under Release mode, with optimizations set to Ox (Full Optimization), I somehow get better performanc...
(4) odpowiedzi
2015-10-14 11:10 log10() performance on Visual Studio 2015 a lot slower than Visual Studio 2013 for x86 »
We have ported a VS2013 C++/MFC application to VS2015 and are having some rather disturbing issues with the performance and code generated by the VS20...
(1) odpowiedzi
2015-10-13 14:10 Why does a function declaration within another function compile and what does it do? »
I intended to call a private class member function, but by a copy&paste mistake pasted the line as this function is declared in the header file: ...
(2) odpowiedzi
2015-10-09 14:10 Difference between std:string and std::string »
In one function of my code I found a bug. It was written std:string : const std::string currentDateTime() { time_t now = time(0); struct ...
(3) odpowiedzi
2015-09-23 07:09 std::exp of float negative infinity returns negative infinity for x64 builds in Visual C++ 2013 »
Using std::exp to calculate e^-infinity returns -infinity when using the float representation of infinity and building an x64 binary using Visual C++ ...
(1) odpowiedzi
2015-09-22 10:09 GCC runtime libraries vs Microsoft Visual C++ runtime redistributables »
Could anyone shed some light on C++ library versioning and distribution of GCC library (libgcc, libstdc++,..?) Microsoft Visual C++ runtime libra...
(1) odpowiedzi