c++

encoding in boost.spirit

Hi! How i can set encoding for values in assign_a? I need to set cyrrilic, but i havent any idea how to do it #include "filter_data.h" #include <boost/bind.hpp> #include <boost/spirit.hpp> #include <boost/spirit/actor.hpp> #include <boost/spirit/attribute.hpp> #include <boost/config/warning_disable.hpp> #inc...

When abort() is preferred over exit()?

I know the differences between the two. One notable thing is that abort() sends SIGABRT signal, so it may be relevant when your software relies on them. But for a typical application exit() seems to be more safe version of abort()...? Are there any other concerns to use abort() instead of exit()? ...

Typical problem on Inheritance

Possible Duplicate: Why is this not allowed in C++? Why is this not allowed in C++...?? class base { private: public: void func() { cout<<"base"; } }; class derived : private base { private: public: void func() { cout<<"derived"; ...

Memory Layout of application

Hi, The following question is a head-scratcher for me. Assuming that I have two platforms with an identical hardware, the same OS and the same compiler on it. If I compile exactly the same application, can I be sure that the memory layout on both machines will exactly be the same? In other words, both applications have exaclty the same ...

C++ segmentation fault when trying to resolve a CORBA reference

Guys, When im trying to resolve a CORBA reference I receive a segmentation fault. Either im blind or I have done something really stupid for this not work. Im using ACE 5.7.9 TAO 1.7.9 for CORBA. Wondering if anyone can help me please ??? The segmentation fault seems to be happening on the line "serverRef = Corba::Orb::getOrb().resolve...

template method pattern and long parameter lists in c++

After the helpful answers to my last question I started using the template method pattern for a class with a lot of different options. Without having implemented them all, my current declarations for objects of that class now look like this: pc < prg, tc, 9, 0, 4, 4, test, true, true, true, true, false, true, true, 10, 0, -1, 3, 3 > mp;...

Unit testing of private methods

I am in the process of writing of writing some unit tests. In particular I want to test some private methods. So far the I have come up with using. #define private public But I am not happy with this as it will destroy all encapsulation from the point of view of the unit test. What methods do you use to unit-test private methods. ...

Supporting multiple pixel formats

I need to write some code which will operate on a number of pixel formats (eg A8R8G8B8, R8G8B8, R5G6B6, and even potentially floating point formats). Ideally I would like to not have to write each function for each format since that is a massive amount of near identical code. The only thing I could think of is some kind of interface le...

error C2375: redefinition; different linkage

Error place in api: #define DLLEXPORT extern "C" __declspec(dllexport) DLLEXPORT int CAnyseeUSBTVControllerDlg::InitCaptureDevice() { In my .h library class and function definition: class CAnyseeUSBTVControllerDlg : public CDialog { // Construction public: int InitCaptureDevice(void); Any idea how to resolve it? "Error 1...

Data model, cyclic references

I have the following data structure for storing meridians and parallels. Each cartographic point stores: A] geographic and spatial coordinates, cartographic distortions, etc. B] pointer to north/south/east/west node. It allows to store relationships between points, first of all their affiliation to the meridian/parallel... class...

Is _write in io.h a blocking call?

I've inherited some code which, to initialise some hardware, writes a few bytes and then waits for a return. To do this it calls the _write function from io.h. From my testing, it looks like it's locking up at that point. So my questions are as follows: Is that function a blocking function? Is there a way of setting a timeout? Is there...

C++ - 3d geometry question

Hello! Right my own 3d engine (which I'm currently developing) has a very limited abilities in terms of geometry rendering and I want to expand it. What I'm interested in is how-it-should be done in terms of storing the geometrical objects and drawing them. For now my abstraction only supports rendering geometry as generic lists of t...

What's the ATL way to open a named pipe in windows in c++?

hPipe = CreateFile( lpszPipename, // pipe name GENERIC_READ | // read and write access GENERIC_WRITE, 0, // no sharing NULL, // default security attributes OPEN_EXISTING, // opens existing pipe 0, // default attributes N...

Explain Change to GNU C++ filebuf::underflow() interacting with filebuf::seekoff()

My company's products run on a number of qualified Linux hardware/software configurations. Historically, the compiler used has been GNU C++. For purposes of this post, let's consider version 3.2.3 the baseline, as our software 'worked as expected' through that version. With the introduction of a newer qualified platform, using GNU C++ v...

C/C++ open source distributed software

Hi, I've seen many Erlang open source projects in distributed systems. Is there any C/C++ project for using as a base? Thanks! ...

C++ Very strange behaviour measuring function execution time - My head exploded

Besides my head exploding this is what happened. I wanted to measure the execution time of a method from a class. The method was too fast to get an accurate time using QueryPerformanceCounter, GetTickCount or Clock. I called the method 2000 times and measured the time elapsed. start=clock(); for (i=0;i<2000;i++) { myObject->myMeth...

Virtual function implemented in base class not being found by compiler

I've got a situation where it seems like the compiler isn't finding the base class definition/implementation of a virtual function with the same name as another member function. struct One {}; struct Two {}; struct Base { virtual void func( One & ); virtual void func( Two & ) = 0; }; struct Derived : public Base { virtual...

C++ superclass Array yet access subclass methods?

i have an accounts class from that i have 3 types of accounts savings, credit, and homeloan. i created a binary search tree to hold all the accounts as type account how do i now access the methods of the subclasses depending on the type of object? have resolved all errors with syntax and codeing but this. been racking my head for 2 d...

deleting an array of pointer to struct

Hi i have the following struct: struct Message { Agent *_agent; double _val; }; and the following Ptrs array: typedef Message* MessageP; MessageP *_msgArr; _msgArr = new MessageP[MAX_MESSAGES]; this is the method that inserts a Message to the array: void Timing::AddMessage(Agent * const agentPtr, double val) { Messag...

Why are async callback socket methods usually static?

Why are async callback socket methods usually static? (assume I understand static class, method and data objects). Would there be a fundamental design/logic error if one were to write a class using these as instance methods? Is there anything special that one should be careful to avoid? ...