c++

Boost mmap performance vs native memory maps.

I will be writing a benchmarking tool that will test a mix of IOPS and bandwidth of a disk system and as such I will be turning to file backed memory maps for IO. Because the tool is going to need to be on both POSIX and WinNT platforms I can't just use plain old mmaps. Also from what I understand you have to madvise the Linux kernel tha...

How to enable depth testing for the GL_SELECT buffer?

I am using the GL selection buffer to implement mouse picking. Unfortunately, OpenGL is returning hits in the selection buffer even for objects that are entirely occluded. For example, if there is a man hidden behind a wall, the selection buffer will include a hit record for the man even though he is not visible. Selection is implemente...

should always return a pointer to class in interface design?

Hi, I wish I could return an object of virtual base class so that I won't need to deal with the memory management(the idea of function programming also stimulate this pursuit). That means I am looking for some things like below: class Car { public: virtual int price() = 0 ; virtual string brand() = 0 ; } class Interface { ...

Pathetic attempt of an array based stack

Hi there, This is my first pathetic attempt at C++. I did an array based stack in C++ and the destructor is throwing out some memory dump. I can't figure out what went wrong. #include <stdio.h> #include <iostream> #include <exception> using namespace std; class FullStackException : public exception { virtual const char* what() ...

Is there a stable library for RTMP, written in C# or C++?

Tried FluorineFx but it didn't work with our media server. Can anyone suggest a stable RTMP library? It can be open-source or commercial. What we want to accomplish is to send some binary data to Wowza media server using RTMP. ...

What does "loop" mean in "loop device"?

Hi geeks, This maybe a linguistic question. I have checked the loop device on Wikipedia. It is just for mounting files as block device. But what does "loop" mean here? Its usage here is totally bizarre to me. I am not a native English speaker. So could someone explain this jargon to me in plain English? :) Thanks. ...

Windows Firewall using programmatically

Hello, I have difficulties to find anything related windows firewall (about how to add aplications to except list, close ports or disable internet access to some applications) in C++. I found even MS site shows examples in Visual Basic. Where i can find examples in C++ ? Thanks ...

How should the C++ standard be used

Hi, I have this classic question of how should the C++ Standard (I mean the actual official document of the finalized ones) e.g. C++98, C++03 be used to learn and teach C++. My idea is only from the point of view of an average C++ user and not from the point of view of the language lawyers or someone who wishes to be in the Standards c...

Java programmer needs to learn C++ fast

Possible Duplicate: Java to c++ guides Hi, I am a Java programmer, but recently the need came up for me to learn C++ fast. I am thinking in about a week, obviously also with normal daily obligations (meaning I can't spend 8 hrs in front of a computer every day). I realize that this is quite a short time span, and I am certa...

java "this" in c++

I'm in a function in java and I create a new Object passing "this" as paramter: class AClass { AClass(TestClass testClass) { } } class TestClass { AClass doSomething() { return new AClass(this); } } How to do That in C++? Should be: class AClass { AClass(TestClass* testClass) { } }; class TestClass { ...

2D platform game camera in c++

I was wondering how exactly cameras are programmed in a 2D platform game. How is it programmed only to render whats in the view of the camera without rendering the whole map? Also, whats the proper way to do this? ...

How can two applications/processes communicate by COM?

I'm looking for a way to ease the difficulty transferring data from one application/process to another. It's said to be better than UDP or TCP for communicating by processes in the same OS(windows xp here) . Can you provide some core code that illustrate this? ...

Why union can't be used in Inheritance ?

Hi, I saw below thing in c++ standard (§9.5/1): A union shall not have base classes. A union shall not be used as a base class. A union can have member functions (including constructors and destructors), but not virtual (10.3) functions From above, union can have constructor and destructor as well. So why is it not al...

boost::weak_ptr interaction with custom deleter

I have a boost::shared_ptr with a custom deleter attached. When converting this to weak_ptr is the deleter information lost? If yes, how do I reattach the same deleter to shared_ptr-s acquired from weak_ptr::lock() method? The feature I am implementing is a container of weak_ptr-s pointing to the alive instances of some type. I need th...

Qt, MySQL server has gone away

Here my code snippet: query.next(); qDebug()<<query.lastError(); qlonglong res=query.value(0).toLongLong(); qDebug()<<query.lastError(); and the corresponding log I have: Debug: QSqlError(2006, "QMYSQL: Unable to execute query", "MySQL server has gone away") Warning: QSqlQuery::value: not positioned on a valid record Debug: QSqlErro...

template parameters, #define and code duplication

I have a lot of code like this: #define WITH_FEATURE_X struct A { #ifdef WITH_FEATURE_X // ... declare some variables Y #endif void f (); }; void A::f () { // ... do something #ifdef WITH_FEATURE_X // ... do something and use Y #else // ... do something else #endif // ... do something } and I'd like to replace the #defin...

How to get a live snapshot from IP camera?

Has anyone ever managed to do this? I'm totally out of clues now.. ...

How to trace NaN in C++

I am going to do some math calculations using C++ . The input floating point number is a valid number, but after calculations , the resulting value becomes NaN. I would like to trace the point where NaN value appears (possibly using gdb), instead of inserting a lot of isNan() into the code. But, I found that even code like this wil...

Is it possible to have source code that 'times out' (becomes invalid after a certain moment)?

We are currently busy migrating from Visual Studio 2005 to Visual Studio 2010 (using unmanaged C/C++). This means that about half of our developers are already using Visual Studio 2010, while the other half is still using Visual Studio 2005. Recently, I came into a situation where a certain construction can be written in a clean way in...

What to do about a 11000 lines C++ source file?

So we have this huge (is 11000 lines huge?) mainmodule.cpp source file in our project and every time I have to touch it I cringe :-) As this file is so central and large, it keeps accumulating more and more code and I can't think of a good way to make it actually start to shrink. The file is used and actively changed in several (> 10) ...