c++

Does Poco C++ library have a cross platform WaitForMultipleObjects() analog?

Based on this question I am going to use Poco::NamedEvent, but I need to wait for multiple events (like win32 WaitForMultipleObjects() Is there such a thing in poco? (searching the docs doesn't yield much but perhaps I am not using the right searches) ...

How to define a macro that retains its scope after it's been called

I'm trying to make a macro to make it easier to define properties. Simplified example but at the moment I have this to provide a property with a public get and private set: #define propertyRO(xxType, xxName)\ property xxType xxName\ {\ xxType get() {return m___##xxName;}\ void set(xxType value) {m___##xxName = v...

C++ Code Analysis - how to add custom dictionary?

;) Yeah. I also have C++ in my solution. How do I add a custom dictionary there? There is no tool for an includes file, as well as no way to tell it the type is CustomDictionary. THe advice and approach shown in http://msdn.microsoft.com/en-us/library/bb514188(v=VS.100).aspx is not usable for C++ projects. ...

How do I detect that my application is running as service or in an interactive session?

I'm writing an application that is able to run as a service or standalone but I want to detect if the application was executed as a service or in a normal user session. ...

How do I set the QT debugger to give more meaningful messages?

Hello all I'm currently learning the QT framework. I need to know if it's possible to set the debugger to give meaningful messages as opposed to what it gives me right now, which is the failed step in the build process (usually the '.o' file) I need to know if it's possible to set it to giving meaningful message like Visual studio ...

Question regarding two dimensional array

I have some problems using two dimensional array in the code and need some help. static const int PATTERNS[20][4]; static void init_PATTERN() { // problem #1 int (&patterns)[20][4] = const_cast<int[20][4]>(PATTERNS); ... } extern void UsePattern(int a, const int** patterns, int patterns_size); // problem #2 UsePattern(10, ...

Strlen of MAX 16 chars string using bitwise operators

The challenge is to find the fastest way to determine in C/C++ the length of a c-string using bitwise operations in C. char thestring[16]; The c-string has a max size of 16 chars and is inside a buffer If the string is equal to 16 chars doesn't have the null byte at the end. I am sure can be done but didn't got it right yet. I am wo...

Qt Sockets and Endianness

Hello I'm writing a program that uses QUdpSocket for transmiting data over the network. This is my first socket program, and I've come across an interesting problem called Endianness. My actual question in, do I have to worry about Endianness when I'm using QNetwork as my sockets library? If I do have to worry, what do I have to do to ...

New to C/C++ Using Android NDK to port Legacy code, getting compile errors

I have been trying to take some old Symbian C++ code over to Android today using the NDK. I have little to no C or C++ knowledge so its been a chore, however has to be done. My main issue is that I'm having trouble porting what I believe is Symbian specifi code to work using the small C/C++ subset that is available with the Android NDK...

Problem with Mergesort in C++

vector<int>& mergesort(vector<int> &a) { if (a.size() == 1) return a; int middle = a.size() / 2; vector<int>::const_iterator first = a.begin(); vector<int>::const_iterator mid = a.begin() + (middle - 1); vector<int>::const_iterator last = a.end(); vector<int> ll(first, mid); vector<int> rr(mid, last); vec...

save part of picturebox content as image

hi, following situation: loading an image into a pictureBox works selecting ( / marking) an area by drawing a rectangle via ControlPaint::FillReversibleRectangle(...) works how do i save the selected part of the image? thanks alot ...

g++, cost of exceptions when I don't use exceptions.

I've some C++ projects, which does not use exception handling. What are the benefits of adding -fno-exceptions , or does gcc figure out itself that I don't use exceptions(nor any libraries that uses exceptions) ? ...

Set designed Tframe on some Tpanel

I am totally novice in C++ Builder. Never tried working with VCL frames. So, i have some Tform with Tpanel and two frames designed. How can i display designed frames on my forms panel? Tired searching similar examples. ...

Why aren't operator conversions implicitly called for templated functions? (C++)

I have the following code: template <class T> struct pointer { operator pointer<const T>() const; }; void f(pointer<const float>); template <typename U> void tf(pointer<const U>); void g() { pointer<float> ptr; f(ptr); tf(ptr); } When I compile the code with gcc 4.3.3 I get a message (aaa.cc:17: error: no matching function...

Calling R Script from within C-Code

Hi, Is there a way to call an R-Script within C-Code? I did find the R Api for C (chaper 6. of the 'Writing R Extensions' manual), but as far as I understood this does "only" allow to call the C-Implementation of R. Of cause I could call the R-Script via shell, but that's no solution for me, since this does not allow proper passing of...

Behavior of virtual function in C++

Hi everyone: I have a question, here are two classes below: class Base{ public: virtual void toString(); // generic implementation } class Derive : public Base{ public: ( virtual ) void toString(); // specific implementation } The question is: If I wanna subclass of class Derive perf...

Composite key syntax in Boost MultiIndex

...

What is the most popular general purpose C++ Framework?

Hi All, I was looking at Qt and came to wondering, what is the most popular general purpose C++ framework, and what are some pro's and con's? Thanks, Kyle ...

C++: Initialization Order for Member Classes

In the following code, when the ctor of X is called will the ctor of A or B be called first? Does the order in which they are placed in the body of the class control this? If somebody can provide a snippet of text from the C++ standard that talks about this issue, that would be perfect. class A; class B; class X { private: A a; B b; }...

How to make this C++ code more DRY?

I have these two methods on a class that differ only in one method call. Obviously, this is very un-DRY, especially as both use the same formula. int PlayerCharacter::getAttack() { int attack; attack = 1 + this->level; for(int i = 0; i < this->current_equipment; i++) { attack += this->equipment[i].getAttack(); } ...