c++

What's a good code coverage tool for use with Visual Studio (C++)?

I'm looking for a code coverage tool that I can easily use with Visual Studio. It must support c++. What have your experiences been with these applications? Did they work well with lots of lines of code? (we have somewhere in the region of a million lines of code). How well does it break down the results? Lines? Functions ? Classes? Does...

Approximating a shape boundary using Fourier descriptors

I am trying to approximate shape boundaries by using Fourier descriptors. I know this can be done because I've learned about it in class and read about it in several sources. To obtain the Fourier descriptors of a boundary of (x,y) coordinates, I do the following: 1) Turn (x,y) coordinates into complex numbers of the form x + iy 2) Feed...

Advice on C Programming with MSVC++ 9

Hey guys. I'm not new to programming but I am a beginner at C and C++ coding. I only know the basics of the C language and how to write small and simple programs so far. I'm not interested in learning C++ for the long haul but I am interested in becoming a fluent C programmer. My predicament is adjusting to the MS Visual Studio 2008 envi...

Can the HWND from CreateWindow/CreateDialog be GetMessage'd from another thread?

Using the Win32 APIs, is it possible to create a Window or Dialog in one thread then collect events for it from another thread? Are HWNDs tied to threads? Trying the contrived example below I never see GetMessage() fire. HWND g_hWnd; DWORD WINAPI myThreadProc(LPVOID lpParam) { while(GetMessage( CreateThread(NULL, 0 myThreadP...

Get optarg as a C++ string object

I am using getopt_long to process command line arguments in a C++ application. The examples all show something like printf("Username: %s\n", optarg) in the processing examples. This is great for showing an example, but I want to be able to actually store the values for use later. Much of the rest of the code uses string objects instead o...

How to identify if an object should be on the stack or not?

I was looking for a rule of thumb for allocating objects on stack or heap in C++. I have found many discussions here on SO. Many people said, it's about the lifetime of an object. If you need more lifetime than the scope of the function, put it in the heap. That makes perfect sense. But what made me confusing is, many people said, allo...

Error with two ways of linking boost regex

I understand that boost regex static library is created with the ar utility by archiving the individual object files. I linked boost regex library by using the -l option in gcc. This worked very well. g++ *.o libboost_regex-gcc-1_37.a -o sairay.out I individually compiled the boost regex source files and then tried to link the object...

Microsoft _s functions, are they part of the C++ standard now?

I just recently changed my IDE to MS Visual Studio 2005 coming from MSVC++ 6, and I've gotten a lot of deprecation warnings. Rather than ignore the warning, I started to change them to the _s equivalents. However, I then found out that these were microsoft-only implementations. I read somewhere that they were pushing for these to beco...

How to get debug information for an abstract(?) pimpl in C++?

I have a wrapper class that delegates its work to a pimpl, and the pimpl is a pointer to a baseclass/interface with no data that is specialized in several different ways. Like this: class Base { void doStuff=0; }; class Derived { int x,y; void doStuff() { x = (x+y*2)*x; //whatever } }; class Wrapper { Bas...

Stack unwinding in case of structured exceptions

This question provides more clarity on the problem described here. I did some more investigation and found that the stack unwinding is not happening in the following piece of code: class One { public: int x ; }; class Wrapper { public: Wrapper(CString csText):mcsText(csText) { CString csTempText; csTempText.Format...

Searching for Junk Characters in a String

Friends I want to integrate the following code into the main application code. The junk characters that come populated with the o/p string dumps the application The following code snipette doesnt work.. void stringCheck(char*); int main() { char some_str[] = "Common Application FE LBS Serverr is down"; stringCheck(some_str); ...

vector scope with struct

Hi, Beginner question here: im reading a file, storing the feilds into struct members, then storing the name of the struct into a vector. I output the size of my vector and debug it to see if it worked and i have the feilds from the file isolated. im doing this in a vector *ptrFunc() function. and i return the &vectorObject so i don...

How to know when the work is done with CThreadPool?

I recently discovered ATL's CThreadPool class and was very happy with this find. It's a neat little class that will take care of the syncronization semantics of having multiple worker threads to process some queue of taks to do. The tasks are fed to the CThreadPool object, by some extrnal process. While being very neat an clean, there d...

Best Replacement for a Character Array

we have a data structure struct MyData { int length ; char package[MAX_SIZE]; }; where MAX_SIZE is a fixed value . Now we want to change it so as to support "unlimited" package length greater than MAX_SIZE . one of the proposed solution is to replace the static array with a pointer and then dynamically allocating the...

What is the best way to transfer error information from worker threads under CThreadPool?

I recently discovered ATL's CThreadPool class and was very happy with this find. It's a neat little class that will take care of the syncronization semantics of having multiple worker threads to process some queue of taks to do. The tasks are fed to the CThreadPool object, by some extrnal process. Now suppose one of the worker threads e...

C++ (Standard) Exceptions and Unicode

I'm running into an issue where I'm processing unicode strings and I want to do some error reporting with standard exceptions. The error messages contained in standard exceptions are not unicode. Usually that hasn't been a problem for me because I can define the error message in non-unicode and have enough information, but in this case...

Clean vector every loop iteration. What is the most memory efficient way?

Hi, I have a question about the std::vector. I have a very memory intensive algorithm where I forsee that predicting vector sizes and reserving enough memory for the vectors in advance will help me a lot with reducing memory usage. Which of the following is better: for ( ... ) { std::vector<Type> my_vector; my_vector.reserve(stuff...

De facto list of primitive types usable in C++

If, for example, you're going to write a variant type class, you will naturally need identification of what type an instance of that class is carrying. I'm wondering if anyone knows of any official or semi-official (de-facto?) reference of all primitive datatypes one would possibly be interested in? Only primitives, and no need for abs...

How do I catch system-level exceptions in Linux C++?

The following catch() is not called: void test(void) { int i=1,j=0,k; try { k = i/j; } catch(...) { ...handle it... } } Is there a way to catch this kind of exception? ...

C++ Extended Ascii characters

Hi All How to detect the presence of Extended ASCII values (128 to 255) in a C++ character array. Thank you ...