c++

Not locking mutex for pthread_cond_timedwait and pthread_cond_signal ( on Linux )

Is there any downside to calling pthread_cond_timedwait without taking a lock on the associated mutex first, and also not taking a mutex lock when calling pthread_cond_signal ? In my case there is really no condition to check, I want a behavior very similar to Java wait(long) and notify(). According to the documentation, there can be ...

What exactly does C++ profiling (google cpu perf tools) measure?

I trying to get started with Google Perf Tools to profile some CPU intensive applications. It's a statistical calculation that dumps each step to a file using `ofstream'. I'm not a C++ expert so I'm having troubling finding the bottleneck. My first pass gives results: Total: 857 samples 357 41.7% 41.7% 357 41.7% _write$UN...

Complete C++ i18n gettext() "hello world" example.

I am looking for a complete i18n gettext() hello world example. I have started a script based upon A tutorial on Native Language Support using GNU gettext by G. Mohanty. I am using Linux and G++. Code: cat >hellogt.cxx <<EOF // hellogt.cxx #include <libintl.h> #include <locale.h> #include <iostream> #include <cstdlib> int main (){ ...

What line of code could I use in C++ to disable energy saver?

I want to prevent the monitor from going to sleep (the windows setting, not the monitor setting). I am using c++. What call do I make? ...

How to remove black background from textures in OpenGL

Hi, I'm looking for a way to remove the background of a 24bit bitmap, while keeping the main image totally opaque, up until now blending has served the purpose but now I need to keep the main bit opaque. I've searched on Google but found nothing helpful, I think I'm probably searching for the wrong terms though, so any help would be gre...

How can I force the 32-bit version of the remote desktop client to run on 64 bit Vista?

We need to run the 32-bit version of the remote desktop client on 64 bit Vista, because part of our product integrates with it, and communicates with the terminal server side app via the virtual channel. The integration loads some third party 32-bit drivers, and it is not possible to load a 32-bit dll in a 64-bit process. Normally it i...

Boost::Asio::Ip::Tcp::Iostream questions

Hey all, I'm new to asio and boost, I've been trying to implement a TCP Server & Client so that I could transmit an std::vector - but I've failed so far. I'm finding the boost documentation of Asio lacking (to say the least) and hard to understand (english is not my primary language). In any case, I've been looking at the iostreams exam...

"Smart" Linked Scrollbar and Edit Controls?

Hello, I hope that I can explain my problem well enough for someone to help. Basically, I have a horizontal scrollbar (ranged 0 to 1000) and an edit control that represents the position of the scrollbar divided by 1000, so that the user can use either the scrollbar to select a range of numbers between 0 and 1 up to a 3 decimal precisio...

Browser Helper Object UI

I am a newbie working towards developing an IE extension that would appear as an overlay in certain webpages. I am getting started by creating a simple BHO in VS2008 (using C++), but I am wondering how UI may be incorporated within the project. Any ideas? Just to give you an idea, I'm looking for overlays similar to what was developed by...

C++, ways to benchmark improvements in cache locality?

I have an implementation of a class X, that has two pointers to two pieces of information. I have written a new implementation, class Y, that has only one pointer to a struct that contains the two pieces of information together as adjacent members. X's and Y's methods usually only need to manipulate one of the pieces of information, but ...

Borland c++ version 0.7 is it still available?

Hello, My cousin is actually asking me if it's still available but I can't find that version, since it's too old, he's complaining about version 5.5 saying that it doesn't recognize his libraries. Is there any link? I doubt but I thought I'll give it a shot. 0.7 is way too old i know :D thank you. ...

How to terminate a hanging thread inside a dll correctly?

Hi Everybody, I have a third party library that contains an error. When I call a function it may hang. The library function is called inside a dll. I decided to move the call into the thread and wait for some time. If thread is finished then OK. If not – I should terminate it compulsory. The simplified example here: unsigned Counter =...

Model - View - Controler in Qt

I understand more or less how does MPV works. But I don't get what classes: QAbstractItemModel QAbstractItemView QAbstractItemDelegate / QItemDelegate Can do for me? If that is relevant, I'm using QGraphicsScene / QGraphicsView with some elements (visual representation of game board) that user can interact with while the interaction log...

Relationship between MSVC++ rand() and C# System.Random

How can I make it so the same sequence of random numbers come out of an MSVC++ program and a C# .NET program? Is it possible? Is there any relationship between MSVC++ rand() and System.Random? Given the example below it seems they are totally different. #include <iostream> using namespace std; int main() { srand( 1 ) ; cout <<...

Hard to find bug on a custom C++ class

I need help on finding the problem using a custom c++ class to manage 3D positions. Here is the relevant code from the class Punto operator+(Punto p){ return Punto(this->x + p.x, this->y + p.y, this->z + p.z); } Punto operator+(Punto *p){ return Punto(this->x + p->x, this->y + p->y, this->z + p->z); } Punto operator-...

Exceptions on Linux from a shared object (.so)

I have a test program called ftest. It loads .so files that contain tests and runs the tests that it finds in there. One of these tests loads and runs a .so that contains a Postgres database driver for our O/RM. When the Postgres driver throws an exception which is defined in that .so file (or one that it links to, but ftest does not li...

How to maintain sessions with C++ code?

There is a cgi code written in C++. Currently there is no session management done in the web pages. There is a need to provide sessions in the web pages so that the user can login, maintain session and then logoff. While this is a fairly simple task in java with HttpSession, I have no clue how to do this with C++ code. ...

Migrating Borland C++ to C#

I have to execute project where I need to migrate Borland C++ code to C#, what are the important steps I need to follow for smooth migration of code? and please suggest any kind of Tips and Tricks? ...

Getting faulting module OLEACC.dll, version 4.2.5406.0 error in Event viewer application log ?

Hi Friends, My application crashes with an error saying "Demo Application pk/si component has stopped working". The systems Event Viewer log shows an error with the following details. "Faulting application Demo.exe, version 1.0.0.1, faulting module OLEACC.dll,version 4.2.5406.0, time stamp 0x4549bd93,exception code 0xc0000005,fault of...

How to detect whether there is a specific member variable in class?

For creating algorithm template function I need to know whether x or X (and y or Y) in class that is template argument. It may by useful when using my function for MFC CPoint class or GDI+ PointF class or some others. All of them use different x in them. My solution could be reduces to the following code: template<int> struct TT {typed...