How does switch compile in Visual C++ and how optimized and fast is it?

A switch is often compiled to a jump-table (one comparison to find out which code to run), or if that is not possible, the compiler may still reorder the comparisons, so as to perform a binary search among the values (log N comparisons). An if-else chain is a linear search (although, I suppose, if all … Read more

When can outer braces be omitted in an initializer list?

The extra braces are needed because std::array is an aggregate and POD, unlike other containers in the standard library. std::array doesn’t have a user-defined constructor. Its first data member is an array of size N (which you pass as a template argument), and this member is directly initialized with an initializer. The extra braces are … Read more

Visual Studio 2010’s strange “warning LNK4042”

I had a similar problem with linker warning LNK4042: object specified more than once; extras ignored. In my case Visual Studio was trying to compile both header and source files with the same name – MyClass.h and MyClass.cpp. It happened because I renamed .cpp file to .h and Visual Studio got confused. I noticed the … Read more

Error when installing windows SDK 7.1

This is a known issue http://support.microsoft.com/kb/2717426 CAUSE This issue occurs when you install the Windows 7 SDK on a computer that has a newer version of the Visual C++ 2010 Redistributable installed. RESOLUTION To resolve this issue, you must uninstall all versions of the Visual C++ 2010 Redistributable before installing the Windows 7 SDK. You … Read more

Should I add .vcxproj.filter files to source control?

We intentionally pulled the .filter. file information out of the .vcproj when we translated to the .vcxproj MSBuild format. One reason is exactly what you pointed out, that the filters are purely a logical view, and different team members may want different views. The other is that sometimes the build is set up to check … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)