c++

Can APC interrupt WSAWaitForMultipleEvents?

Can APC (Asynchronous Procedure Calls) interrupt WSAWaitForMultipleEvents()? (C++) MSDN does not list this WSAWaitForMultipleEvents() on the APC page ( http://msdn.microsoft.com/en-us/library/ms681951.aspx ). I do not have visual studio in front of me right now to try it. Can somebody please let me know? Thanks ...

How to track memory leaks with umdh.exe in all heaps?

I have a c++ windows application that leaks memory per transaction. Using perfmon I can see the private bytes increase with every transaction, the memory usage is flat while the application is idle. Following previous answers on stackoverflow I used umdh from the microsoft debugging tools to track down one memory leak. However there i...

OpenCV with Network Cameras

I'm using openCV 1.1pre1 under Windows. I have a network camera and I need to grab frames from openCV. That camera can stream a standard mpeg4 stream over RTSP or mjpeg over http. I've seen many threads talking about using ffmpeg with openCV but I cannot make it work. How I can grab frames from an IP camera with openCV? Thanks Andrea ...

Should "portable" C compile as C++?

I got a comment to an answer I posted on a C question, where the commenter suggested the code should be written to compile with a C++ compiler, since the original question mentioned the code should be "portable". Is this a common interpretation of "portable C"? As I said in a further comment to that answer, it's totally surprising to me...

C++ STL: Can arrays be used transparently with STL functions?

I was under the assumption that STL functions could be used only with STL data containers (like vector) until I saw this piece of code: #include <functional> #include <iostream> #include <numeric> using namespace std; int main() { int a[] = {9, 8, 7}; cerr << "Sum: " << accumulate(&a[0], &a[3], 0, plus<int>()) << endl; retu...

C++ namespaces advice

Just teaching myself c++ namespaces (coming from a c# background) and i'm really starting to think that all the things that c++ does better then most other languages, nested namespaces isn't one of them! Am i right in thinking that in order to declare nested namespaces i HAVE to do the following: namespace tier1 { namespace tier2...

Force-directed layout in C++

Are you aware of an open source implementation of force-directed layout in C++ used for GUIs? Preferably BSD/MIT/Apache or other (non-GPL) license. ...

C++ as a first language

I've been self-learning C++ for about 4 months now. I'm enjoying it, and I think I'm doing quite well. However, an answer to a question of mine got me thinking that I might be setting myself up for a fall. So, what do people here think about C++ as a first language to learn? And is it worth me just carrying on now that I've made a good ...

Strange results with floating-point comparison

I have this simple test: double h; ... // code that assigns h its initial value, used below ... if ((h>0) && (h<1)){ //branch 1 -some computations } else{ //branch 2- no computations } I listed my values as I got some really strange results and for example if: h=1 then the first branch is reached and I do not understand why since if...

Naming functions, methods, pointers, variables, arrays etc in C++

Allright, doing some project with few friends, and I need some standard for naming things in c++. Does anyone have any good naming scheme for c++ that is well thought-out and not made in like 10min. Example, int* house should be named int* house_p, so that when someone reads the code, he doesn't need to scroll all the time wondering if ...

.NET - Finalizers and exit(0)

I have a .NET C# / C++ app which uses a call to exit(0) (from <stdlib.h>) in a thread in order to terminate. The strange part is, under some circumstances, the finalizers of the managed objects are called right after the call to exit, and in other circumstances, they are not called at all. The circumstances are pretty deterministic - t...

C++, OLE, Excel Automation: EAccessviolation at 00000800

I am writing an background service application that has to automatically read data from Excel 2003 files. But no matter what I try, the method OlePropertyGet() always results in an EAccessViolation error while trying to read from address "00000800". The error always occurs at the last line of this code snippet, and seems independent of ...

How do I return an std::set with a private comparator

Hi folks, I'd like to write a (C++) method that returns an std::set of custom objects. I do not however want to expose the comparator used when inserting the objects, so I make it a private class. I create the set like this: std::set<some_class, some_class_comparator> return_object; now I want to return the set, so it has to be cast ...

JPEG Quality when creating a JPEG in Carbon

I'm writing a Carbon application and we are creating JPEG files. I'm currently doing this by using Quartz CGImageDestinations and kCGImagePropertyJFIFDictionary. However, JFIF doesn't seem to have any entry for compression quality. Does anyone know how to set this? thanks ...

Process Explorer - How does the dragabble crosshair work?

There is a feature in sysinternal's process explorer that allows a crosshair to be dragged from the application to a control in any other application you are running and highlights said control. Does anyone know how this was achieved or if there is a .NET/C++ library out there that can be reused? ...

c++ template casting

Hi, I'm a little lost in how to cast templates. I have a function foo which takes a parameter of type ParamVector<double>*. I would like to pass in a ParamVector<float>*, and I can't figure out how to overload the casting operator for my ParamVector class, and Google isn't helping me that much. Does anyone have an example of how to do th...

Has anyone used tntnet?

I'm looking for a C++ MVC framework. Has anyone used http://www.tntnet.org/index.html? How was it compared with like MVC.net or SpringMVC? What compiler is required for it? ...

Open source Visual Studio project distribution nightmare...

Every time Microsoft releases a new version of visual studio, they always require me to convert my solution and project files to 'the latest version.' Even with something as simple as a "Hello World" solution, I need to go through their conversion wizard! And, to make things worse, the new visual studio solution files aren't compatible...

Alloca implementation

How does one implement alloca() using inline x86 assembler in languages like D, C, and C++? I want to create a slightly modified version of it, but first I need to know how the standard version is implemented. Reading the disassembly from compilers doesn't help because they perform so many optimizations, and I just want the canonical f...

OpenGL context without opening a window - wglMakeCurrent fails with HDC and HGLRC when using HWND made with GetDesktopWindow

This is somewhat a duplicate of this question. I am trying to make a windowless console application to check up on OpenGL version supported. In order to do this I need to set up a render context - but without creating a window. I am trying to use desktop handle, which I won't write to. I forgot to set pixel format in previous example -...