c++

What is RtlPcToFileHeader?

I am profiling an application using VerySleepy 0.7. The application is written in C++ with Qt 4.6.x, compiled with VS 2005 and is running on Windows 7 Ultimate x64. The highest usage by far is a call to RtlPcToFileHeader Exclusive Inclusive %Exclusive %Inclusive Module 33.67s 33.67s 15.13% 15.13% ntdll It is not clear t...

High-performance C++ multi-dimensional arrays

I am looking for advice regarding high performance multi-dimensional array libraries/classes for C++. What I really need is: the ability to dynamically allocate arrays with a size determined at run-time the ability to access and modify single array values (fast) to be able to use simple array arithmetic such as array1 = array2 + 2 * ar...

Must I CloseHandle() on a thread handle ?

_beginthreadex returns a handle to a thread: m_hStreamStatsThread = (HANDLE) _beginthreadex( NULL, 0, StreamStatsThread, this, 0, NULL ); This handle may be used if you need to refer to the thread in calls like TerminateThread(..) for example. According to the MSDN page on _beginthreadex, _beginthreadex won't always return a valid ha...

Object-Oriented Suicide or delete this;

The following code compiled with MSVC9.0 runs and outputs Destructor four times, which is logical. #include <iostream> class SomeClass { public: void CommitSuicide() { delete this; } void Reincarnate() { this->~SomeClass(); new (this) SomeClass; } ~SomeClass() { std::cout << "Destructor\n...

Arrays are Pointers??

Possible Duplicate: Is array name a pointer in C? Are arrays and pointers implemented differently? I have come across this question because , in both the cases we access elements from the starting address of an element.So , there should be close relation between them . Please explain the exact relation between them . Thanks. ...

Trying to study shine MPEG Layer-III encoder - getting "redeclaration of C++ built-in type 'bool'"

Greetings. I am studying the way mpeg layer-III encoding works for an upcoming project. I downloaded the shine encoder as it is said to be the simpliest of all. http://www.mp3-tech.org/programmer/sources/shine.zip is the link. I successfully compiled them in a standalone project but i need to be using them in a QT project. I made new ...

Interview question to ask on knowledge of multi-threading

Someone said 90% of programmers cannot solve a binary search. So for a guy who claimed he has in depth understanding on multi-threading technology, what is the basic but ideal question to ask? It can be either C++ or Java. ...

How can I detect keyboard and/or mouse input on Windows Mobile?

I'm working on a small C++ project which involves a launcher application that does a bit of setup work and then invokes the real application. To be precise, I'm working on the launcher application - the real application is done by a separate team. These programs are both deployed to Windows Mobile devices. Now, I'd like to be able to get...

Why were threads never included as part of the C++ standard?

Why is it that threads were never included as part of the C++ standard originally? Did they not exist when C++ standard was first created? ...

C++ tstring compare

hello again I have this variable dirpath2 where I store the deepest directory name of a path: typedef std::basic_string<TCHAR> tstring; tstring dirPath = destPath; tstring dirpath2 = dirPath.substr(destPathLenght - 7,destPathLenght - 1); I want to be able to compare it it another string, something like: if ( _tcscmp(dirpath2,failed)...

Attribute lists or inheritance jungle?

I've got 2 applications (lets call them AppA and AppB) communicating with each other. AppA is sending objects to AppB. There could be different objects and AppB does not support every object. An object could be a Model (think of a game, where models are vehicles, houses, persons etc). There could be different AppBs. Each supporting anoth...

Requesting complete, compilable libxml2 sax example.

I'm having a heck of a time figuring out how to use the sax parser for libxml2. Can someone post an example that parses this XML ( yes, without the <xml...> header and footer tags, if that can be parsed by the libxml2 sax parser): <hello foo="bar">world</hello> The parser should print out the data enclosed in element hello and also g...

Windows Named Pipe Support in Linux

I'm looking at a project which will require inter-process communication between a legacy Windows application using named pipes, and a new service running on a Linux server. The windows application cannot be changed. Does anyone know if there is a Linux library available that supports Windows named pipes? Or even better, can anyone recomm...

Optimum Update frequency for a client server based multiplayer game

I am making a multiplayer game in c++ : The clients simply take commands from the users, calculate their player's new position and communicate it to the server. The server accepts such position updates from all clients and broadcasts the same about each to every. In such a scenario, what parameters should determine the time gap between ...

What is this second new?

What is the second line? (Seen while answering another question.) int * x = new int [1] ; int * y = new (x) int; After the second line x and y have the same value (point to a same place). What's the difference between y = x and the second line? Is it like a constructor or something? ...

Conditional wait overhead

When using boost::conditional_variable, ACE_Conditional or directly pthread_cond_wait, is there any overhead for the waiting itself? These are more specific issues that trouble be: After the waiting thread is unscheduled, will it be scheduled back before the wait expires and then unscheduled again or it will stay unscheduled until sign...

C++ Floating point exception with global list array

I'm just getting started, but I'm already having trouble. So far, my code is simply: (In Searcher.h) #ifndef SEARCHER_H #define SEARCHER_H #include <string> #include <list> using namespace std; class Searcher{ public: Searcher( int& x ); ~Searcher(); private: int size; list<string> * lists; }; #endif (In Searcher.cpp) ...

does exists a stl data structures that "holds" a current element index/pointer ?

i would like to improve my c++ code style so i decided that i definitively have to deep into stl...at first, as i need it in a real case, i woudl like to know if it is available some kind of container that hold a current index inside... for example i mean some container class i can navigate with next()/prev() but i can also ask for g...

c++ pointer management with local variables

I've got a method that creates some Foo and adds it to a vector of Foos. Foos are in charge of deleting their Bars during destruction. The Foo constructor takes a pointer of Bars and a size of them. When the function returns, the local Foo gets deleted and destroys its Bars, however I get a valid Foo object back. How should I be handlin...

C++ template constructor

Hello! I wish to have a non-template class with a template constructor with no arguments. As far as I understand, it's impossible to have it (because it would conflict with the default constructor - am I right?), and the workaround is the following: class A{ template <typename U> A(U* dummy) { // Do something } }; Maybe the...