c++

Is there any advantage to using C++/CLI over either standard C++ or C#?

I'm not seeing any real advantages, other than the fact that you have a C++ syntax, and with it, things like pointers and destructors. ...

Global instance of a class in C++

As the title says. How would I create an instance of a class that is globally available(for example I have a functor for printing and i want to have a single global instance of this(though the possibility of creating more)). ...

How to debug code that uses boost w/o losing sanity?

Boost is a great set of libraries and it really boosts productivity. But debugging code that uses it is a total nightmare. Sure, stepping through twenty thousand header files can be a valuable intellectual exercise, but what if you need to do it over and over again? Is there a developer-friendly way of just skipping the boost portion an...

Do I get a finished slot if a start QProcess using startDetached

Do I get a finished signal if I start a QProcess using startDetached()? I'm trying to start a process, but I need to be able to get an event when the process has terminated. ...

How can I implement a RESTful webservice using C++?

Hi, I have to develop a computing intensive Web Service (say we are making really big Matrix computations) so I've think that the way to go is coding it in C++. I can't do a wrapper using SWIG or JNI in Java to benefit from the WS existing libraries because the computations are state dependant and involve big matrices. Passing those val...

Modifying controls with Form.Controls

I'm passing a reference of a form to a class. Within this class I believed I could use formRef->Controls["controlName"] to access properties on the control. This works for a few labels, but on a button I receive a "Object reference not set to an instance of an object." when I try to change the Text property. Help or explanation appreci...

ms c++ get pid of current process

Part of my application is in C++ under windows. I need the process id for the current process. Any thoughts? ...

C++ Console Breaking

Hi all, Wondering what the best way to trigger a function ( so I can perform a graceful exit ) in a C++ console application on Ctrl+C is? ...

Overriding a member variable in C++

I have run into a bit of a tricky problem in some C++ code, which is most easily described using code. I have classes that are something like: class MyVarBase { } class MyVar : public MyVarBase { int Foo(); } class MyBase { public: MyBase(MyVarBase* v) : m_var(v) {} virtual MyVarBase* GetVar() { return m_var; } private: ...

Debugging with command-line parameters in Visual Studio.

I'm developing a C++ command-line application in Visual Studio and need to debug it with command-line arguments. At the moment I just run the generated EXE file with the arguments I need (like this program.exe -file.txt) , but this way I can't debug. Is there somewhere I can specify the arguments for debugging? ...

Beginner Visual C++ 6 tutorial

Hi people, here is my situation. I have an small console application written in C++ (it makes and saves a .avi file into HD). I have to make it a visual app in order to set times, frames per second, etc. I have NO IDEA how to start. I never used Visual C++ before. I can't even open a simple "OK, Cancel" dialog box... I need the most b...

Image scaling and rotating in C/C++

What is the best way to scale a 2D image array? For instance, suppose I have an image of 1024 x 2048 bytes, with each byte being a pixel. Each pixel is a grayscale level from 0 to 255. I would like to be able to scale this image by an arbitrary factor and get a new image. So, if I scale the image by a factor of 0.68, I should get a new i...

C++ Multiple Virtual Inheritance vs. COM

Hi! The net is overflowing with explanations of the "dreaded diamond problem". So is StackOverflow. I think I understand that bit, but I fail to translate that knowledge into comprehending something similar yet different. My question begins as a pure C++ question, but the answer might well branch over into MS-COM specifics. The genera...

CUDA: Wrapping device memory allocation in C++

Hello, I'm starting to use CUDA at the moment and have to admit that I'm a bit disappointed with the C API. I understand the reasons for choosing C but had the language been based on C++ instead, several aspects would have been a lot simpler, e.g. device memory allocation (via cudaMalloc). My plan was to do this myself, using overloade...

VARIANT_BOOL vs. BOOL

I am writing a COM object in C++ using ATL and am not sure whether I should be using VARIANT_BOOL for my methods/properties or not. The object will be called by other C++ apps but I cannot rule out usage from .NET. I can stick to good old BOOL (which IIRC is simply an unsigned int) but as VARIANT_BOOL is there, shouldn't I be using it?...

Preferred namespace syntax for source files

Assuming a class called Bar in a namespace called foo, which syntax do you prefer for your source (.cpp/.cc) file? namespace foo { ... void Bar::SomeMethod() { ... } } // foo or void foo::Bar::SomeMethod() { ... } I use namespaces heavily and prefer the first syntax, but when adding code using the Visual Studio Class Wizar...

How to keep a C++ realtime server application with a modern web client interface?

I develop industrial client/server application (C++) with strong real time requirements. I feel it is time to change the look of the client interface - which is developed in MFC - but I am wondering which would be the right choice. If I go for a web client is there any way to exchange data between C++ and javascript other than AJAX <-> ...

How does one execute a no-op in C/C++?

for the following: ( a != b ) ? cout<<"not equal" : cout<<"equal"; suppose I don't care if it's equal, how can I use the above statement by substituting cout<<"equal" with a no-op. ...

Borland C++: Ambiguity with std

Hello I've been developing a DLL in Visual Studio 2005. At the moment it compiles and does what it's supposed to. However, I wanted to compile it using Borland C++ 2006 because I've heard that is better and makes faster code. When I try to do it I get error messages like this one: E2015 Ambiguity between strcmp(const char *,const char...

Enum in C++ like Enum in Ada?

At one point I had looked at implementing a class/template in C++ that would support an Enum that would behave like it does in Ada. It has been some time since I thought about this problem and I was wondering if anyone has ever solved this problem? EDIT: My apologies, I should clarify what functionality I thought were useful in the Ada...