visual-c++

How well does the Visual C++ 2008/2010 compiler optimize?

Im just wondering how good the MSVC++ Compiler can optimize code(with Code examples) or what he can't optimize and why. For example i used the SSE-intrinsics with something like this(var is an __m128 value)(it was for an frustrum-culling test): if( var.m128_f32[0] > 0.0f && var.m128_f32[1] > 0.0f && var.m128_f32[2] > 0.0f && var.m128_f...

Find out which functions were inlined

When compiling C++ with GCC 4.4 or MSVC is it possible to get the compiler to emit messages when a function is inlined? ...

Trouble with 'extern' Keyword

Hi, I have a set of global variables and a method in a cpp file. int a; int b; int c; void DoStuff() { } in the header file I have declared them explicitly with the extern keyword. My problem is when I include the header file in another C++ file, I can't use the external variables and the method. It's giving a linker error sayin...

what is the difference between Malloc and new operator to allocate a memory?

Possible Duplicate: What is the difference between new/delete and malloc/free? I was confused when I create an object by using new operator in C++. There must be difference between malloc and new operator that would allow me to resize the memory block. If I want to allocate a memory I use malloc but what if I use a new operato...

STLport compatibility

I get the impression STLport has substantial potential performance gains over Dinkumware's STL - so I'm considering porting a large MSVC solution to STLport to try it out. The solution has several external dependencies, some of them 3rd party. I see vague mentions of linkage/runtime issues to be expected - must indeed such a migration...

Strange words appearing during compilation of Application

I am having a service written in C++ and i use VC++ 6.0. When i build this service i get a strange message as shown (The letter 'T'coming during compilation). Though it does not cause any problem, i would like to know why this message occurs. Compiling... SerString.cpp SerSwitcher.cpp Smtp.cpp SysConfigBlob.cpp T T TransLateReportNames...

C++0x : are tuples of tuples allowed?

I'm currently working on a class with a lot of templates and being able to build tuples of tuples would make it a lot easier But I tried this simple code in MSVC++ 2010: #include <tuple> void main() { auto x = std::make_tuple(std::make_tuple(5, true)); } And I get a compilation error. The same problem happens if I don't use std...

Creating a shared MFC Dialog: Regular DLL or MFC extension DLL

When creating a MFC DLL project in VC++ 2005, you get a screen "application settings" with a choice of Regular DLL with static/dynamic MFC, or an MFC Extension DLL. We want a DLL that contains a few common dialogs, so we can use them in other projects e.g: CGetNameDlg *dlg = new CGetNameDlg(); dlg->doModal(); string name = dlg->getName...

null int value in VC++

Hi there, I want to have a condition in my program that finds if there is NO value in an array. Usually the array will be filed with 4 values. On a rare occasion it is filled with 6. I want to use an if statement that says, if the exampleArray[5] is not equal to null, do this Something like... eg. if(!array[5]->Equals(null){ /...

c++ ternary operator

So I ran into something interesting that I didn't realize about the ternary operator (at least in Visual C++ 98-2010). As pointed out in http://msdn.microsoft.com/en-us/library/e4213hs1(VS.71).aspx if both the expression and conditional-expression are l-values the result is an l-value. Of course normally in c/c++ you'd write something ...

__typeof -identifier not found

For some reason I keep getting error C3861: '__typeof': identifier not found when I compile my program! I'm including the following libraries: <iostream> <stdlib> <stdio> Any ideas? thanks Edit: More example User.h class User{} main.cpp void f(User* p) { . . . __typeof(p) ... . . . . } ...

MSVC 2008: Cannot View Reigsters or Memory with Native Code

I am having trouble viewing the registers and memory in Visual Studio 2008. I am working with native code with no CLR. I have tried the following: >Debug.Registers Command "Debug.Registers" is not available. Ctrl+Alt G >Debug.Memory1 Command "Debug.Memory1" is not available. Ctrl+Alt+M 1 The key command (Ctrl+Alt+M, 1) is currently boun...

How to Determine Resource-ID of the CMFCRibbonButton using NMHDR Structure ?

I implemented my own CMFCToolTipCtrl class in order to modify enhanced tooltip in Ribbon Control.But I'm unable to determine Resource ID from NMHDR Structure.How to get it ? ////////////////////////////// MainApp.cpp ////////////////////////////// CMFCToolTipInfo ttParams; ttParams.m_bVislManagerTheme =FALSE; theApp.GetTooltipManager...

Visual Studio compiled Qt Plugin doesn't load in release mode

Hi, I am developing a Qt application and a Qt Plugin library. Everything is working fine as far as I use the debug mode. Nevertheless, when I try to compile in release mode the plugin doesn't load. I got the following error message from QPluginLoader: Expected build key "Windows msvc release full-config" got "Windows msvc debug ful...

Exporting a MFC Dialog from a DLL

21st July: Updated, see bottom In VC++ 2005 I have 2 projects. Firstly, a MFC DLL project (not an extension DLL) which has a simple dialog: TestDlg.h #pragma once #include "afxwin.h" #include "resource.h" // CTestDlg dialog namespace Dialogs { class __declspec(dllexport) CTestDlg : public CDialog { DECLARE_DYNAMIC(CTes...

Newbie design considerations for a C/C++ application

I'm quite new to programming "larger" applications. I have now written a command line application with a few thousand lines of code in Visual C++ 2010, which compiles and works fine. Most of the code is C-compliant (I think), however, I found it useful to use some C++ constructs here and there. E.g., sometimes I used new/delete instead o...

VariantClear() throws an exception when called on A VARIANT containing a SAFEARRAY

Hi, I am trying to wrap up some data from an array of BYTES into a VARIANT but I can't seem to free the data: When I run this code... SAFEARRAY * NewSArray; SAFEARRAYBOUND aDim[1]; // a one dimensional array aDim[0].lLbound = 0; //Sets the index to start from 0 //Sets the number of elements (bytes) that will go into the SAFEARRAY aD...

RegQueryValueEx gets a weird value

I am trying to retrieve some values from the registry. Here is the full path: [HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes] "ThemeChangesMousePointers"=0x00000001 (1) And here is my code: HKEY hKey; DWORD dwDisp = REG_DWORD; DWORD dwType; DWORD dwSize = sizeof(DWORD); DWORD dwValue = 0; DWORD dwReturn; char buffe...

How do I add a custom build target to a Visual C++ 2010 project?

There are plenty of guides out there which help you mimic VS2008's "Custom Build Step" in VS2010 with MSBuild. However, I'd like my build to be smarter and make use of MSBuild. I've written a little MSBuild task which invokes the ANTLR parser generator. That build task works flawlessly when I run it in a simple test MSBuild file. However...

::std::vector::at() vs operator[] << surprising results!! 5 to 10 times slower/faster!

During program optimization, trying to optimize a loop that iterates through a vector, I found the following fact: ::std::vector::at() is EXTREMELY slower than operator[] ! The operator[] is 5 to 10 times faster than at(), both in release & debug builds (VS2008 x86). Reading a bit on the web got me to realize that at() has boundary che...