c++

GCC compiling a dll with __stdcall

When we compile a dll using __stdcall inside visual studio 2008 the compiled function names inside the dll are. FunctionName Though when we compile the same dll using GCC using wx-dev-cpp GCC appends the number of paramers the function has, so the name of the function using Dependency walker looks like. FunctionName@numberOfParameters...

Unit testing MFC UI applications?

How do you unit test a large MFC UI application? We have a few large MFC applications that have been in development for many years, we use some standard automated QA tools to run basic scripts to check fundamentals, file open etc. These are run by the QA group post the daily build. But we would like to introduce procedures such that in...

XML-RPC: best way to handle 64-bit values?

So the official XML-RPC standard doesn't support 64-bit values. But in these modern times, 64-bit values are increasingly common. How do you handle these? What XML-RPC extensions are the most common? What language bindings are there? I'm especially interested in Python and C++, but all information is appreciated. ...

Whats the best Ribbon UI control to retro fit to a legacy MFC application build with VC2005?

What experience have you had with introducing a Ribbon style control to legacy MFC applications? I know it exists in the new VC2008 Feature Pack, but changing compilers from VC2005 is a big deal for our source base and integration to our environment, Intel FORTRAN, ClearCase, many 3rd libraries. There are quiet a few different commeri...

What's the simplest way to test whether a number is a power of 2 in C++?

I need a function like this: // return true iff 'n' is a power of 2, e.g. // is_power_of_2(16) => true is_power_of_2(3) => false bool is_power_of_2(int n); Can anyone suggest how I could write this? Can you tell me a good web site where this sort of algorithm can be found? ...

Is it a good (correct) way to encapsulate a collection?

class MyContainedClass { }; class MyClass { public: MyContainedClass * getElement() { // ... std::list<MyContainedClass>::iterator it = ... // retrieve somehow return &(*it); } // other methods private: std::list<MyContainedClass> m_contained; }; Though msdn says std::list should not perform relocations of elements...

Data structure for assembly code? [research]

I'm planning to create a data structure optimized to hold assembly code. That way I can be totally responsible for the optimization algorithms that will be working on this structure. If I can compile while running. It will be kind of dynamic execution. Is this possible? Have any one seen something like this? Should I use structs to link...

RSA encryption library for c++

Hello I am developing a win32 application and I would like to use an RSA encryption library. What Library would you reccomend? ...

Needless pointer-casts in C

I got a comment to my answer on this thread: http://stackoverflow.com/questions/105477 In short I had code like this: int * somefunc (void) { int * temp = (int*) malloc (sizeof (int)); temp[0] = 0; return temp; } I got this comment: Can I just say, please don't cast the return value of malloc? It is not required and ca...

Dynamically created operators

I created a program using dev-cpp and wxwidgets which solves a puzzle. The user must fill the operations blocks and the results blocks, and the program will solve it. Im solving it using bruteforce, i generate all non repeated 9 length number combinations using a recursive algorithm. It does it pretty fast. Up to here all is great! But t...

Why use c strings in c++?

Is there any good reason to use C-strings in C++ nowadays? My textbook uses them in examples at some points, and I really feel like it would be easier just to use a std::string. ...

Getting a FILE* from a std::fstream

Is there a (cross-platform) way to get a C FILE* handle from a C++ std::fstream ? The reason I ask is because my C++ library accepts fstreams and in one particular function I'd like to use a C library that accepts a FILE*. ...

What are some examples of exceptional C++ open-source code?

The best way to learn is by practicing, but it's always good to learn from others who are smarter than you. What is the best example of a well-designed, well coded open-source project? I'm specifically interested in C++ projects, but other exceptional examples would be welcome, as well. ...

Which to go with long term - C, Objective C, or C++?

One thing I've really been meaning to get back into is C++ programming but I am not sure if I should go back to C++ (which I have some basic console programming knowledge) or should I look into C or Objective C? I'm looking at the long term as well as ease of coding such as good editors, compilers, etc as well as which would be the quick...

Not getting event arguments in IHTMLElement event handler

I've added a callback to an IHTMLElement instance but when the IDispatch::Invoke is called for the event, there are never any arguments (i.e. the pDispParams->cArgs and pDispParams->cNamedArgs are always 0). For example, I add a callback for an onmouseup event. From what I can tell, a callback for this event is supposed to receive a Mous...

How to retrieve all keys (or values) from a std::map?

This is one of the possible ways I come out: struct RetrieveKey { template <typename T> typename T::first_type operator()(T keyValuePair) const { return keyValuePair.first; } }; map<int, int> m; vector<int> keys; // Retrieve all keys transform(m.begin(), m.end(), back_inserter(keys), RetrieveKey()); // Dump al...

TinyXML: Save document to char * or string

I'm attempting to use TinyXML to read and save from memory, instead of only reading and saving files to disk. It seems that the documnent's parse function can load a char *. But then I need to save the document to a char * when I'm done with it. Does anyone know about this? Edit: The printing & streaming functions aren't what I'm looki...

Cleaning up Legacy Code "header spaghetti"

Hi, Any recommended practices for cleaning up "header spaghetti" which is causing extremely slow compilation times (Linux/Unix)? Is there any equvalent to "#pragma once" with GCC? (found conflicting messages regarding this) Thanks. ...

Dynamically importing a C++ class from a DLL

What is the correct way to import a C++ class from a DLL? We're using Visual C++. There's the dllexport/exports.def+LoadLibrary+GetProcAddress trifecta, but it doesn't work on C++ classes, only C functions. Is this due to C++ name-mangling? How do I make this work? ...

How to get a full call stack in Visual Studio 2005?

How can I get a full call stack for a c++ application developed with Visual Studio 2005? I would like to have a full call stack including the code in the system libraries. Do I have to change some settings in Visual Studio, or do I have to install additional software? ...