c++

C++ books on (extremely) low latency programming?

Hi there, Im very interested in a career in designing trading systems which requires low latency programming. I wondered if anybody knows good books for low latency c++? ...

How do I programmatically (C++) check the code signing date of an EXE in Windows?

Is this possible? How do I go about doing it? Does it require admin rights? (I would not think so) A pointer to a help page or link is fine - no need to provide code. Given my difficulty with he code signing cert and setting it up in our build environment I am not sure I am googling with the right terms. EDIT After some searchin...

pure virtual and inline definition

struct device{ virtual void switchon()=0{} }; int main() { } I wrote code similar to following and it gave error. pure-specifier on function-definition compilation terminated due to -Wfatal-errors. When I asked him, he showed me the following quote from the Standard A virtual function declared in a class shall b...

Why C++ delete operator doesn't set pointer to NULL?

Possible Duplicate: Why doesn't delete set the pointer to NULL? Is there any purpose for a pointer to deallocated memory? ...

Why is this comparison always true?

I have the following code in my file: unsigned char * pData = new unsigned char... ... if(pData[0] >= 160 && pData[0] <= 255) When I compile it, I get a warning from the compiler (gcc): Warning: comparison is always true due to limited range of data type How can this be? Isn't the range of an unsigned char 0-255? I'm confused....

C++ program error

I am not able to solve 3 error . Programs implementation is right but not sure how to get rid of 3 errors # include <iostream.h> # include < conio.h> void main() { class coord { float x; float y; //Constructor coord(float init_x,float init_y) { x= init_x; y= init_y; } ...

Vector insert crashes program.

Can anyone tell me why this crashes my program? It's suppose to make it so order has all the elements in the t vector situated by (y + height). Edit: crashes on the lines with "insert" in them. void createDrawOrder(vector<Thing*> t, vector<int> *order) { int min = t[0]->y + t[0]->height; int max = t[0]->y + t[0]->heigh...

Linked List Losing nodes after leaving recursive function

struct Letter { char let; Letter *next; }; Please look at the function below called addLETTERS(). int main() { Letter *Top = 0; Letter *head = 0; char letters = 'a'; head = new Letter; Top = new Letter; MakeNull(head); MakeNull(Top); addLETTERS(Top, head,letters); retur...

Reading/Writing from STL Map in multithreaded environment

Problem: I need to write a function which returns a value for a input key from a map. If function can't found the value in map it will fetch the value from database, write into map for future use and return the same. There can be multiple threads calling this function. I am thinking on this line: string GetData (const int key) { p...

Standard C functions: Check for -1 or 0?

Many standard C and POSIX functions return -1 for error, and 0 on success, for example truncate, fflush, msync, etc. int ret = truncate("/some/file", 42); Is it better practice to check for success with ret != -1 or ret == 0, and why? My Thoughts It's my experience most people check for the error case (ret != -1), as there is typica...

Structure or Class with variable number of members

I want to create a structure/class with a variable number of class members which could be decided at compilation stage (like done in template metaprogramming) Example : Its hypothetical in which both type and variable names are to be specified like Type T1 variable name should be varName1 and so on ..... template <class T1 (varName1) >...

C++ variable redefinition

I have a file: variableinclude.h #ifndef _variableinclude_h_ #define _variableinclude_h_ AClass* variable1; int* variable2; #endif But I include this file in another two different ones: - atest1.h - atest2.h The problem is the following: variable redefinition. How to avoid that??? ...

Glibc detected malloc() memory corruption 0xb6179bb8 when calling new keyword C++

My programme run to a point where calling the new keyword would cause the error stated above. eg. char* a = new char[100]. The error is reproducible and everytime I run the programme it is until that point of calling new keyword that causes problem. It seems to be the memory location is corrupted at the point. What is the possible cause...

Skiplast random function need explained

I read about skipList implementation in C++ and I don't understand this random function : float frand() { return (float) rand() / RAND_MAX; } int random_level() { static bool first = true; if (first) { srand( (unsigned)time(NULL) ); first = false; } int lvl = (int)(log(frand())/log(1.-P)); retu...

Creating a wxActiveXContainer

My objective is to display an active x object in wxwidgets. I have declared two member pointers: TeeChart::ITChartPtr mpChart; wxActiveXContainer* mpAx; I then create an instance of the teechart control: mpChart.CreateInstance("TeeChart.TChart"); I then wish to create an instance of the wxActiveXContainer defined as: wxActiveXCon...

C++ Uninitialized memory?

I am sometimes (randomly) getting incorrect initialization of values, which makes me think I'm using memory uninitialized somewhere. My main data structure is: template <class state> class learnedStateData { public: learnedStateData() :gCost(DBL_MAX), hCost(0), isDead(false) {} state theState; double gCost; double hCost;...

GNU tool to analyze and reduce compile time for my application

Hi All, I am using SUSE10 (64 bit)/AIX (5.1) and HP I64 (11.3) to compile my application. Just to give some background, my application has around 200KLOC (2Lacs) lines of code (without templates). It is purely C++ code. From measurements, I see that compile time ranges from 45 minutes(SUSE) to around 75 minutes(AIX). Question 1 : Is t...

Finding the points of a triangle after rotation

I'm working on a (rather) simple 2D project in OpenGL. It's some sort of asteroids clone. The ship is basically an isosceles triangle of height H, with the base have a length of H/2. The way I've been doing it so far is simply storing the center point (CP) of the triangle and then calculating the final vertex positions on the fly. The ...

Value access in C++

HI, I have two clases A and B, Here A is inheriting B and now i want to access a variable in B from A, I included A header in B and tried to access but showing some error in QObject. Is it possible to acces like this.. Please help ...

Find function signature in Linux

Given a .so file and function name, is there any simple way to find the function's signature through bash? Return example: @_ZN9CCSPlayer10SwitchTeamEi Thank you. ...