c++

Multi-threading: Signal vs BusyWait(Polling), Inter-thread condition variables questions

Hello, I have a general Question about inter-thread communication. Right now I am using a bunch of C++ thread (~15). They are all using BusyWait(Polling) each others to get data to process. But it is hard to keep cpu usage low && give good performance and avoiding doing too many context switch. So I am looking at Condition variable, ...

What is the good cross platform C++ IDE?

It needs to have good code completion support, debugger, and a nice way to browse code (click to go to documentation). Since I got spoiled by Java IDEs (Eclipse), it would be cool if it supported refactoring, reference search and some form of on the fly compilation, but maybe I'm asking too much. So far I tried Eclipse C++ plugin, Qt C...

What is the sense of "Feature Oriented Programming" (FOP) in C++, and would it make sense in Java and C#?

Hello! Sadly, I can't remember where I read it, but... ...in C++ you can derive a class from a template parameter. Im pretty sure it was called Feature Oriented Programming (FOP) and meant to be somehow useful. It was something like: template <class T> class my_class : T { // some very useful stuff goes here ;) } My questions abo...

C++ math functions problem (under Linux)

I'm having problem regarding max and sqrt If I include math.h it coudn't find sqrt. So I view the cmath header file and inside it includes math.h, but when I try to open math.h it says that file is not found. SO ithink my math.h is missing in Linux. ...

strcpy... want to replace with strcpy_mine which will strncpy and null terminate

the clue is in the title but basically I've inherited some code which has 800+ instances of strcpy. I want to write a new function and then to replace strcpy with strcpy_mine. So I'm trying to work out what parameter list strcpy_mine will have. I tried: void strcpy_mine( char* pTarget, const char* const pCopyMe ) { const unsigned i...

Forward declaration of nested types/classes in C++

I recently got stuck in a situation like this: class A { public: typedef struct/class {...} B; ... C::D *someField; } class C { public: typedef struct/class {...} D; ... A::B *someField; } Usually you can declare a class name: class A; But you can't forward declare a nested type, the following causes compilation er...

Usage of try/catch blocks in C++

In general, I tend to use try/catch for code which has multiple failure points for which the failures have a common handler. In my experience, this is typically code which qualifies input or context before performing some action or output after performing some action. I have received counsel from literature and colleagues to minimize...

.h and .H header files in g++

I am using g++ on Ubuntu with a C++ library whose header files all happen to end in .H instead of the traditional .h. I'd rather not modify the include directory ... otherwise I would probably just create symbolic links to .h versions of the headers. I am wondering if there is an easy way to automatically have g++ recognize that .H and...

Where can I find API documentation for Windows Mobile phone application skin?

I have to customize the look of Windows Mobile (5/6) dialer application. From bits and pieces of information and the actual custom skin implementations in the wild I know that it is actually possible to change a great deal. I am looking for ways to change the look and feel of the following screens: Actual dialer (buttons, number displa...

Building a project with files pending on a parameter

I am trying to find a way to build a C/C++ project to only include certain files depending on an input i.e, if its parameter a include files 1-5. parameter b include files 6-10, etc etc. Basically a script or something to build a project based off of an input for visual studio. Only ideas I have came up with is using preprocessor comma...

Using visual studio 6 c++ compiler from within emacs

Hey guys, I'm just getting started with c++ development and I would like to use emacs to write the code and then compile and run it from within emacs using the visual studio 6 compiler. I have already googled around a bit but just can't seem to find an explanation of how this is done. Any pointers? Thanks for your help, joerg ...

map.erase( map.end() )?

Consider: #include <map> int main() { std::map< int, int > m; m[ 0 ] = 0; m[ 1 ] = 1; m.erase( 0 ); // ok m.erase( 2 ); // no-op m.erase( m.find( 2 ) ); // boom! } (OK, so the title talks abouting erasing an end() iterator, but find will return end() for a non-existent key.) Why is erasing a non-existent ...

practices on when to implement accessors on private member variables rather than making them public

I know the differences between public member variables and accessors on private member variables, and saw a few posts already on stack overflow about this. My question has more to do with practices though. Other than not breaking class invariants, what would usually be criterias in terms of practicality to make the member variables to be...

Disable gcc warning for incompatible options.

I'm curious if there is an option to disable gcc warnings about a parameter not being valid for the language being compiled. Ex: cc1: warning: command line option "-Wno-deprecated" is valid for C++/Java/ObjC++ but not for C Our build system passes the warnings we have decided on globally across a build. We have both C/C++ code and t...

What is the purpose of typedefing a class in C++?

I've seen code like the following frequently in some C++ code I'm looking at: typedef class SomeClass SomeClass; I'm stumped as to what this actually achieves. It seems like this wouldn't change anything. What do typedefs like this do? And if this does something useful, is it worth the extra effort? ...

Sending notifications from C++ DLL to .NET application

I'm writing a C++ DLL that needs to notify client applications. In C++ (MFC), I can register a client window handle inside the DLL, then call PostMessage when I need to notify the client about something. What can I do when the client is a C# application? ...

inline function linker error

I am trying to use inline member functions of a particular class. For example the function declaration and implementation without inlining is as such: in the header file: int GetTplLSize(); in the .cpp file: int NeedleUSsim::GetTplLSize() { return sampleDim[1]; } For some reason if I put the "inline" keyword in either one of t...

Using shared C++/STL code with Objective-C++

I have a lot of shared C++ code that I'd like to use in my iPhone app. I added the .cpp and .h files to my Xcode project and used the classes in my Objective-C++ code. The project compiles fine with 0 errors or warnings. However, when I run it in the simulator I get the following error when I attempt to access an STL method in my obje...

Can one decode real media file to other media formats using any free C++ library??

Please provide some pointers on how to convert real media formats to other popular media formats using some C++ sdk(I guess Helix provides one but don't know how to use it). I am a total newbie in the above area, any help would be highly appreciated. ...

Recommendations for an open-source project to help an experienced developer practice C++

I'm looking for recommendations for open-source projects written in C++ that will help me "get my chops back". A little background: I've been working heavily in Java for the last three years, doing a lot of back-end development and system design, but with a fair amount of work in the presentation layer stuff, too. The last C++ project...