c++

Visual C++ 2008 Express Or Eclipse Ganymede With CDT

I'm learning C++, and I want to know from those who are very good developers now: What is the best IDE, Visual C++ 2008 Express or Eclipse Ganymede with CDT? Remember that I'm using Microsoft Windows Vista Ultimate. Thanks! The book that I'm reading is from Deitel: C++ How to Program, 5/e, because I don't know if the code of the book su...

unix timestamp to boost::posix_time::ptime

I need to convert double with number of seconds since the epoch to ptime. I'm prety sure there must be an easy way to do this, but I couldn't find anything. Thanks. Edit: The original timestamp is floating point. I can't change it and i don't want to lose the sub-second precision. ...

C++ Compilation Problems with Microsoft Visual Studios 2010 Beta 1

Well, I just got the new MSVS 2010 Beta 1, and just like with 2008 express, I just can't figure out how to compile anything, not even a simple hello world program. Anyone have any pointers? I usually just get a blanket fail message. No real information. Edit: Sorry about that #include <iostream> using namespace std; main() { cout ...

Staff Web Service Framework

How does Staff web service framework compare to others for c++? ...

QMake 'subdirs' template - executing a target?

I am putting together a build system for my Qt app using a qmake .pro file that uses the 'subdirs' template. This works fine, and allows me to specify the order that each target is built, so dependencies work nicely. However, I have now added a tool to the project that generates a version number (containing the build date, SVN revision...

Defining Binary Macros in C++

Hi all, Can someone explain why the following error happens: #define bla "\xA" char a [2] = {0}; memcpy (a,bla,1); // a[0] = 0x0a <- Correct //a[1] = bla; // '=' : cannot convert from 'const char [2]' to 'char' Thanks, RM ...

How do you multiply a matrix by itself?

This is what i have so far but I do not think it is right. for (int i = 0 ; i < 5; i++) { for (int j = 0; j < 5; j++) { matrix[i][j] += matrix[i][j] * matrix[i][j]; } } ...

I have a server listening on sockets, whats a good approach to service CPU-bound requests with multiple threads?

I've got an application, written in C++, that uses boost::asio. It listens for requests on a socket, and for each request does some CPU-bound work (e.g. no disk or network i/o), and then responds with a response. This application will run on a multi-core system, so I plan to have (at least) 1 thread per core, to process requests in par...

Resources to learn bitwise programming?

I am a c++ programmer and occasionally I'll come across some code that is using bitwise operators to manipulate things at the bit level, but I have no real understanding of those concepts. So I would like a resource to help me learn it so well that it becomes second nature. Does anyone know of good resources for this? A google search did...

How can I use templates to determine the appropriate argument passing method?

As I understand it, when passing an object to a function that's larger than a register, it's preferable to pass it as a (const) reference, e.g.: void foo(const std::string& bar) { ... } This avoids having to perform a potentially expensive copy of the argument. However, when passing a type that fits into a register, passing it as...

Why STL algorithm find() doesn't work on maps?

Is there any explanation why find() algorithm doesn't work for maps and one have to use map::find instead? ...

How to reserve bottom 4GB VM in an x64 C++ app

Working on porting a 32bit Windows C++ app to 64 bit. Unfortunately, the code uses frequent casting in both directions between DWORD and pointer values. One of the ideas is to reserve the first 4GB of virtual process space as early as possible during process startup so that all subsequent calls to reserve memory will be from virtual add...

C++ GCC4.4 warning: array subscript is above array bounds

I recently upgraded to GCC 4.4 (MinGW TDM build) and now the follow code produces these warning: In member function 'void Console::print(const std::string&)': warning: array subscript is above array bounds Here's the code: void Console::print( const std::string& str ) { std::string newLine( str ); if( newLine.size()...

What is a good easy to use profiler for C++ on Linux?

I need to profile some code running C++ on Linux. Can you guys recommend some profilers? ...

Difference Betwen Visual C++ 2008 And g++

I'm learning C++ and when I was testing the Microsoft Visual C++ 2008 Express and Eclipse Ganymede, but with the g++ compiler as default, I've noted that a same code in VC++ get some errors and in g++ compile normally, without errors or warnings and execute normally, but I want to know what is the difference between VC++ syntax and g++ s...

Win32 Message Handler Error Propagation

I'm writing a (C++) application that utilizes a single dialog box. After setting up a message pump and handler I started wondering how I would go about propagating C++ exceptions to my original code (i.e., the code that calls CreateDialogParam, for instance). Here's a skeleton example of what I mean: BOOL CALLBACK DialogProc(HWND, UINT...

How do I generate an HTML file using XSL?

Hello, As I understand it, using XSL to generate documents has two parts: 1) An XML document which references an XSL stylesheet 2) An XSL stylesheet Let's say that I want to generate a document using XSL, and then send it to a friend. Without relying on the stylesheet being available on the internet, and without including the styleshe...

What are the performance implications of inheriting a class vs including a ptr to an instance of the class as a member variable?

I am working in a class "A" that requires very high performance and am trying to work out the implications either way. If I inherit this new class "B", the memory profile of "A" should increase by that much. If I include just a ptr to "B" as a member variable in "A", then would I be correct in thinking that, as long as "B" is on the ...

How do you execute an INSERT statement using MySQL (in c++)?

Google is failing me (or I am failing Google.) I am simply looking for the function that executes an INSERT statement using the mysql.h library in C++. ...

Handling windowStateChanged - Tab change in IE extension

I have the following in my IE extension to handle when a tab is switched in IE, etc. [ATL project, VS2008, C++ using IDispEventImpl] SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2, DISPID_WINDOWSTATECHANGED,WindowStateChanged) . . . void WindowStateChanged (DWORD dwFlags, DWORD dwValidFlagsMask); . . . . void CHelloWorld::WindowStateChang...