c++

Array of member function pointers : Getting 0xcccccccc when control reached pointer to member function

Hi, I got error Access Violation when the following code is execute : void NoAction() { (*m_psStateMachine[0][0])(); } class CXcp { public: CXcp(){} CXcp(WORD wXcpProtocol); ~CXcp(); private: void (*m_psStateMachine[10][16])(); public: // Action Methods from State M/c Table in the RFC// void IrcScr_6(){} void IrcS...

Excel addin development environment

If I want to build an excel addin with C++. Is there any opensource/freeware alternative to the Visual Studio development environment? Thanks Dean ...

Overloading += in c++

If I've overloaded operator+ and operator= do I still need to overload operator+= for something like this to work: -?- MyClass mc1, mc2; mc1 += mc2; ...

Is returning a std::list costly?

I was wondering if returning a list, instead of returning a pointer to one, was costly in term of performance because if I recall, a list doesn't have a lot of attributes (isn't it something like 3 pointers? One for the current position, one for the beginning and one for the end?). ...

conversion precedence in c++

Hi, I have the following code: Some functions: A::A(int i_a) {cout<<"int Ctor\n";} //conversion constructor void h(double d) {cout<<"double param\n";} //f1 void h(A a) {cout<<"A param\n";} //f2 In the main function: h(1); The function that h(1) calls is f1. My question is why does it choose to call that....

SetCurrentDirectory timing out

Is it possible for the SetCurrentDirectory() to timeout if there is network slowdown preventing the directory from being accessed for some length of time? (In the order of 15-30 seconds...?) If so is the timeout configurable and where can it be set? ...

How do I read the windows registry (Default) value using QSettings?

I want to read the registry to find the current PowerPoint version. However this just returns Zero: QSettings settings("HKEY_CLASSES_ROOT\PowerPoint.Application\CurrVer", QSettings::NativeFormat); QString sReturnedValue = settings.value( "(Default)", "0" ).toString(); Any suggestions as to how I get the value ...

restructuring dependencies of some files in a project using precompiled headers causes linker errors

I'm using MSVC++ 6 to build a very large project. Some of the source files in this project are shared with a small utility that we use for maintaining the application. Previously, this small utility required linking against many libs from the main app and also required the main app's DLLs at runtime. I was tasked with removing these d...

casting producing const objects in c++

Would it be correct to say that whenever casting is used, the resulting object is a const object? ...And therefore can only be used as an argument to a function if that function accepts it as a const object? e.g. class C1 { public: C1(int i=7, double d = 2.5){}; }; void f(C1& c) {}; int main(){ f(8); return 1; } //won't...

How does the friend keyword (Class/Function) break encapsulation in C++?

Some programmer said that, "a friend function break the encapsulation in C++". and some programmer also said, "Friend functions do not break encapsulation; instead they naturally extend the encapsulation barrier" what does it mean?.. If a friend function breaks the encapsulation in C++ then how?? ...

What is the most dangerous feature of C++?

I've heard lots of times that phrase of Bjarne Stroustrup "C++ makes it harder to shoot yourself in the foot; but when you do, it takes off the whole leg" and I don't really know if it is as terrible as it sounds. What's the worst thing that has ever happened to you (or more properly, to your software) while programming in C++? In which...

AccessViolationException when string is too long (C++)

Hi all, I asked a similar question a couple of days ago, but I'm looking for more insight. I'm getting an AccessViolationException when I add a string to my program: Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at _cexit(...

Google Performance Tools (profiler) tutorial

I just downloaded and built the libraries/executables of Google Performance Tools. Before I run the CPU profiler on the application that I want to investigate, I want to learn how to use the tools properly perhaps on a sample application. What would be a good example to run the Google CPU profiler on? Thanks in advance. ...

What is the destruction order of the View/Doc/Frame in a CMultiDocTemplate?

I'm working in an MDI application that has a pointer to a document's frame object. Other threads are calling PostMessage using the pointer. During shutdown, the threads continue trying to post messages to the frame while the frame is being destructed. Does anyone know the destruction order of the multiple documents in MFC's MDI implement...

what is a Class and Object in C++?

Can we say that a Class is a Object? ...

When might multiple inheritance be the only reasonable solution?

To be clear, I'm not asking if/why multiple inheritance is good or bad. I've heard a lot of arguments from both sides of that debate. I'm wondering if there is any kind of design problem or scenario in C++ in which multiple inheritance is either the only way to accomplish something, or at least is the most optimal way over all other alt...

Using auto and decltype in C++0x

I'm trying to learn the currently accepted features of c++0x and I'm having trouble with auto and decltype. As a learning exercise I'm extending the std class list with some generic functions. template<class _Ty, class _Ax = allocator<_Ty>> class FList : public std::list<_Ty, _Ax> { public: void iter(const function<void (_Ty)>& f) ...

Static declarations are not considered for a function call if the function is not qualified.

"painting/qpathclipper.cpp", line 1643.30: 1540-0274 (S) The name lookup for "fuzzyCompare" did not find a declaration. "painting/qpathclipper.cpp", line 1643.30: 1540-1292 (I) Static declarations are not considered for a function call if the function is not qualified. I'm trying to compile Qt 4.5.0 on xlC 9.0.0.4a, and getting the abo...

Faster to malloc multiple small times or few large times?

When using malloc to allocate memory, is it generally quicker to do multiple mallocs of smaller chunks of data or fewer mallocs of larger chunks of data? For example, say you are working with an image file that has black pixels and white pixels. You are iterating through the pixels and want to save the x and y position of each black pi...

Strange memory problem of Loki::Singleton, Loki::SmartPtr, and std::vector

I had encountered a problem while using Loki::Singleton, Loki::SmartPtr, and std::vector under VC express 2008. Following is my source. #include <iostream> #include <vector> #include <loki/Singleton.h> #include <loki/SmartPtr.h> class Foo { public: std::vector<Loki::SmartPtr<Foo>> children ; void add() { Loki::SmartP...