c++

Execution Path Specific Breakpoint

I would like Visual Studio debugger to break within a function only when the call is from a specific sequence of callers. Is there a way to set such a breakpoint? Or perhaps some alternative hack? I ask this in the context of native (C++) as well as managed (C#) code. ...

how to pass xml schema through sockets ?

Hi Could someone please help and tell me if there is a possibility to pass an xml schema through a socket program written in C/C++ ? here is an example: ---- c/C++ ---- ... struct zone { // as an example char *Var_name="xxx"; float var_value = 1.3; }; ----- xml --- ... <xs:element name="zone"> <xs:complexType> <xs:sequence>...

How do i get visual studio 2008 to create a class for my MFC dialog resource?

I used to use VC 6 a while back and there was a simple to use "wizard" that would create a class out of a dialog created in the GUI editor. I am using 2008 professional and there seems to be no way to generate this. I can try to make it based on a template of previous projects, but it seems to me that is missing. Where did they bury...

Compile Qt UI file?

How do you compile the UI files to generate the Headers? Is there another way then having the Qt project mirror the visual studio project and compiling with Qt to get them? I guess I could have a bat file or something that does it. What needs to be run to generate the header files from the UI? ...

C++ Vector vs Array (Time)

I have got here two programs with me, both are doing exactly the same task. They are just setting an boolean array / vector to the value true. The program using vector takes 27 seconds to run whereas the program involving array with 5 times greater size takes less than 1 s. I would like to know the exact reason as to why there is such a ...

C++ Abstract Base Class Problem

Hey Everyone, So I have run into a problem with my ABC design in C++. I'm going to use a simplified example from what I actually have. Please ignore any syntax errors until I get to where my issue is. So I have an ABC: class ABC { public: virtual void DoSomething() = 0; }; Then I have a derived class: class Derived: p...

inline asm buffer loop

Ok here's my problem. I want to loop through a simple char buffer using inline asm and VC++; My agenda is to create a loop that reads information from memory as fast as physically possible heres my code char buffer[howmany]; memset(buffer,33,howmany); char arr = 0; __asm { MOV eax,seg buffer ;operand size conflict MOV eds,eax ...

When to use inline funtion and when not to use it ?

I know that inline is a hint or request to compiler and its used to avoid function call overheads. So on what basis one can determine whether a funtion is a candidate for inlining or not ? In which case one should avoid inlining ? ...

C++ source tagging

Any suggestions on a quality way to tag and search c++ code. I use cscope/ctags for most stuff, but I have found it insufficient to find my way around some of the overly complex c++ code at work. I have started to switch from vim to Slickedit (which is still not perfect, but better) for browsing code, but would like to go back to exclusi...

Ultra-light gzip compression implementation?

I'm searching for an ultra-light gzip compression/decompression library in C++ (something definitively lighter than zlib) on a libral (BSD, MIT, PD) license. Googling revealed many libraries, but either they are bloated (like GZ compression in Crypto++) or on a more restrictive license. It's hard to believe for me, that there's no light...

MMC 3.0 C++ Development and Hosting Windows Forms

Here it says that MMC 3.0 provides Windows forms hosting capability. However all examples and resources are .NET framework targeted. So I wonder where this capability exists - native level or managed wrapper level? I know of Microsoft.ManagementConsole.dll but that is the managed world. Does MMC 3.0 really support Windows Forms natively ...

C++: shallow/deep copy of std::map

How would I best implement these? I thought of something like this: using namespace std; shape_container shape_container::clone_deep () const { shape_container* ptr = new shape_container(); copy( data.begin(), data.end(), (*ptr).begin() ); return *ptr; } shape_container shape_contai...

Constructors accepting string reference. Bad idea?

It's considered a bad idea/bad design, have a class with a constructor accepting a reference, like the following? class Compiler { public: Compiler( const std::string& fileName ); ~Compiler(); //etc private: const std::string& m_CurrentFileName; }; or should I use values? I actually do care about performance. Thank you in adva...

Copy constructor not called, but compiler complains that there's no

Hi there! Given the following code: #include <boost/noncopyable.hpp> enum Error { ERR_OK=0 }; struct Filter : private boost::noncopyable { Filter() {} virtual ~Filter() {} virtual int filter(int* data) const = 0; }; struct SpecialFilter : public Filter, private boost::noncopyable { inline SpecialFilter(unsigned int min, u...

How to design a C / C++ library to be usable in many client languages?

I'm planning to code a library that should be usable by a large number of people in on a wide spectrum of platforms. What do I have to consider to design it right? To make this questions more specific, there are four "subquestions" at the end. Choice of language Considering all the known requirements and details, I concluded that a lib...

Hash Object problem in C++

Hello, In some C++ program I have two classes - Abc and Xyz. The Abc class contains an integer member Foo, like in the following listing: class Abc { public: int Foo; Abc(int f) { Foo = f; } }; class Xyz{}; I'm using a map<Abc, Xyz> but the performance is extremly poor. That's why I'd like to use a hash_map<Abc, Xyz> (Dev-Cp...

How to correctly initialize an object. [C++]

Hi, I mentioned in one of my earlier questions that I'm reading book "C++ Coding Standards" By Herb Sutter and Andrei Alexandrescu. In one of the chapters they are saying something like this: Always perform unmanaged resource acquisition, such as a new expression whose result is not immediately passed to a smart pointer constructor, ...

C++ Windows - How to get process path from its PID

Hi How i can get process path from it's PID in C++ (Windows). I search this in Google, MSDN, and stackoverflow.com, but I don't find this. ...

C++/CLI: why should I use it?

I'm pretty familiar with C++, so I considered learning .NET and all its derivatives (especially C#). Along the way I bumped into C++/CLI, and I want to know if there is any specific use for that language? Is it just suppose to be a intermediate language for transforming from native C++ to C#? Another question that popped to my head is ...

ESP Error when I call an API function?

platform : win32 , language : c++ I get this error when I call an imported function I declared: Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different c...