c++

Emitting native code (for a specific platform)

How do you get started generating native code for a target platform? I've got (some) experience and (some) skill in C++, and am interested in going and writing my own compiler (for C++). But I've got little idea how I'm going to turn the end result into native code to execute on my target platform, which at the moment is just Windows, x8...

boost.test vs. CppUnit

I've been using CppUnit for quite a while now (and am happy with it). As we are using more and more parts of the boost library I had a short look on boost.test and I'm wondering now if I should switch to boost.test in a new project or not. Can anyone here tell me about the differences between the two frameworks and the benefits (if ther...

Boost-Python raw pointers constructors

I am trying to expose a C++ library to python using boost-python. The library actually wraps an underlying C api, so uses raw pointers a lot. // implementation of function that creates a Request object inline Request Service::createRequest(const char* operation) const { blpapi_Request_t *request; ExceptionUtil::throwOnError( ...

Connecting to oracle database using C++, the basics

hey there everyone, i have a question about the theory here, i'm just starting a project which is based on C++ applications integrating with oracle DB's, i've came to two choices, OCCI, and OCI the OCCI is said to be aimed at C++ environment, but i was wondering, if it would be any good to use the OCI libraries from my C++ app since i...

Why is −1 > sizeof(int)?

Consider the following code: template<bool> class StaticAssert; template<> class StaticAssert<true> {}; StaticAssert< (-1 < sizeof(int)) > xyz1; // Compile error StaticAssert< (-1 > sizeof(int)) > xyz2; // OK Why is -1 > sizeof(int) true? Is it true that -1 is promoted to unsigned(-1) and then unsigned(-1) > sizeof(int). Is it true ...

Signal a thread accross Process boundary

Would it be possible for a COM client to signal a thread in a COM Server? ...

Wrapping C++ dynamic array with Python+ctypes, segfault

Hi! I wanted to wrap a small C++ code allocating an array with ctypes and there is something wrong with storing the address in a c_void_p object. (Note: the pointers are intentionally cast to void*, 'cause later I want to do the allocation the same way for arrays of C++ objects, too.) The C(++) functions to be wrapped: void* test_all...

GetDIBits() is failing with PNG compression

I am trying to get the size of PNG image (Without storing into file). I am using this code as reference. When calling GetDIBits(), size of image would get updated into bi.biSizeImage. Everything works fine when bi.biCompression is BI_RGB. Then I have changed the compression mode from BI_RGB to BI_PNG; GetDIBits() started to fail. Please ...

C++ dynamic review tools

What's the best tool (commercial/open source) you've used for dynamic review/memory analysis of a C++ application? EDIT: removed 'static' as there is already a great question on this topic (thanks Iulian!) ...

Problem in Communicating with Digitally SIgned c# com dll from c++ in WIN 7 ultimate

Hi All, I have a c# com dll which I register to registry Using regasm . I communicate with this c# dll from a c++ exe . I use create instance to initialize the dll . when both these components are not signed digital it is working perfectly . when they are digitally signed cocreate instance fails. get last error says "Token not found...

C++ - STL vector question

Hello! Is there any way to make std::vector faster on reserving + resizing? I would like to achieve the performance which would be somewhat equivalent to plain C arrays. See the following code snippets: TEST(test, vector1) { for (int i = 0; i < 50; ++i) { std::vector<int> a; a.reserve(10000000); a.resize(10000000...

Why is my DirectShow-based video player producing choppy results, while WMP plays the same videos smoothly?

I am having problems writing a good C++/DirectX9/DirectShow video player. I have tried using the DirectShow samples and modifying them. I've tried VMR9 and TextureRenderer. In all my attempts the video playback is choppy and jerky. In one case I got it nearly smooth, but the audio was out of sync! Windows Media Player always manages ...

ide code information

I've been annoyed lately by the fact that PyDev doesn't information about classes and function when it code completes wxPython code. Can anybody tell me FOSS IDE's or extensions that offer code information (function params, returns etc.) when it code completes for C/C++ and Python. I am a fan of CodeLite, Eclipse CDT and CodeBlocks in ...

C++ ifstream::read() - corrupts ifstream get pointer?

Hi all, Does anyone here know of a way a C++ ifstream's get pointer might get corrupted after a read() call? I'm seeing some truly bizarre behaviour that I'm at a loss to explain. For example (illustrative code, rather than what I'm actually running): int main() { // datafile.bin is a 2MB binary file... std::ifstream ifs( "datafi...

Why C++ STL does not provide hashtable and union data structures?

At various places, I've read that STL does not provide hashtable and union data structures. How could these be implemented using other existing STL data structures? ...

What is a hook function?

Id like to know what excatly is a hook function. Explanation and example in php, c++, or java is fine. ...

c++: explain this function declaration

class PageNavigator { public: // Opens a URL with the given disposition. The transition specifies how this // navigation should be recorded in the history system (for example, typed). virtual void OpenURL(const GURL& url, const GURL& referrer, WindowOpenDisposition disposition, PageTr...

Problems calling Python from C++

test.py def add(a,b): """ """ print a,b,a+b return a+b c program #include <python.h> int _tmain(int argc, _TCHAR* argv[]) { try { PyObject *pName,*pModule,*pDict,*pFunc,*pArgs1,*pArgs2,*pOutput; Py_Initialize(); if(!Py_IsInitialized()) return -1; pModule=PyImport_ImportModule("test"); pDict=PyModule_GetDict(pModu...

Get new mails notification from GMail?

Is there an easy way to get a notification from Google when a Google Mail user gets a new mail? Read- /write support, etc. is not needed. I'm looking for solutions in C, Objective-C or C++. ...

Setting processor affinity for a process and its Effects

Hi I am having an application which has a UI module and other supporting services. These other services have memory leaks and other thread synchronization issues. Hence in some machines especially quad core, dual core machines the services crash every now and then. I know the best way to fix this is to clean up the memory leaks and syn...