The following code demonstrates a weird problem I have in a Turbo C++ Explorer project. One of the three stack objects in D::D() is not destroyed after going out of scope.
This only happens if compiled in release mode, the auto_ptrs a_ and b_ are of different types and the exception thrown doesn't inherit from std::exception. It appear...
Should I make my own framework by wrapping up the STL classes and/or Boost libraries so that if I need to change the implementation of the string, vectors, lists, etc. or I need to write functions that MFC, other other libraries or even other platforms would need to use their format, I can easily mutate them to meet the criteria. this i...
If you are developing a memory intensive application in C++ on Windows, do you opt to write your own custom memory manager to allocate memory from virtual address space or do you allow CRT to take control and do the memory management for you ? I am especially concerned about the fragmentation caused by the allocation and deallocation of ...
I want to take a floating point number in C++, like 2.25125, and a int array filled with the binary value that is used to store the float in memory (IEEE 754).
So I could take a number, and end up with a int num[16] array with the binary value of the float:
num[0] would be 1
num[1] would be 1
num[2] would be 0
num[3] would be 1
and so o...
Which is the best way of validating an input passed to the function i.e. do you validate all input before proceeding some thing like
class A;
void fun(A* p)
{
if(! p)
{
return;
}
B* pB = p->getB();
if(! pB)
{
return;
}
.......
}
Or do you write it like this:
void fun(A* p)
{
if(p)
{
B* pB = p->getB();
...
I'm working on a resource management class and want to have the user provide a functor to a "ReleaseResource" method as part of the resource manager's constructor. From there when a resource is requested that functor will be provided as the deleter for the shared_ptr that I will be returning so that the appropriate method will be called ...
I have recently been given a task to add the ability to interact with Web Map Services to an existing MFC application and I am in need of a client-side HTTP API.
Based on my research, the leading candidates seem to be CAtlHttpClient and WinHTTP. I was curious to see if anyone had experiences they could share or opinions on which woul...
Using the STL's priority_queue I get the error "invalid heap" as soon as I try to use pop(). I can push my values into the queue, the top() of the queue is what I would expect and accessible. pop(), when it goes to re-heap, seems to have a problem.
I am storing pointers to a templated class in the queue. I have the comparision overloade...
I am involved in a venture that will port some communications, parsing, data handling functionality from Win32 to Linux and both will be supported. The problem domain is very sensitive to throughput and performance.
I have very little experience with performance characteristics of boost and ACE. Specifically we want to understand wh...
Hi,
Is there a tool to count the number of methods defined in a header? This seems like something that people would want to do from time to time, but I've never heard of such a utility. I could roll my own (and it'd be quite easy to come up with something that works for me in this particular case), but I thought I'd try stackoverflow fir...
After a number of hours Googling, I think it's time to ask the experts. We have a legacy module (MS Visual C++ 6.0) that we are trying to port to VS 2005. A number of calling applications exist, so we're trying, if possible, to keep these backward-compatible.
Code-wise, this turned out pretty straightforward and a few hours of develop...
I'm pretty much a total idiot when it comes to writing hardware drivers, however I'm fairly decent at C/C++.
I have a for fun project I want to work on that is attempting to use a device as a network tether proxy.
What I would like to do is create a driver that appears to be a network driver to windows, but actually sends/receives thro...
We have a large amount of legacy C++ code in shared libraries that are used on dozens of products. Ignoring the pros and cons of automatically generating tests (that's a discussion for another day), does anyone have any recommendations for a tool that would analyse the source and generate a set of tests to exercise that code?
Ideally it...
Can anyone share a snippet of code where they parsed a user defined object using SAX parser in C++.
...
Does anyone know of a great Qt tutorial for using the designer, I'm new to Qt but I'm intermediate in C++.
...
I am using C++ on Linux. I want to dynamically bind a collection of unknown shared libraries. I need my code to detect all the public functions exposed by the shared library and the string names of those functions. How do I accomplish this task?
...
The C++0x standard is on its way to being complete. Until now, I've dabbled in C++, but avoided learning it thoroughly because it seems like it's missing a lot of modern features that I've been spoiled by in other languages. However, I'd be very interested in C++0x, which addresses a lot of my complaints. Any guesstimates, after the s...
Sometimes, when I open the a file like so:
FILE *file = fopen(fname, "wb");
if(!file) printf("Error code: %d\n",ferror(file));
I get a result of 32. What does this mean? Specifically, for eMbedded Visual C++ 4.0
Also, it seems like eVC does not support perror/errno :(
Final Update: it seems like the underlying problem was with a la...
class test {
public:
test &operator=(const test & other){} // 1
const test & operator+(const test& other) const {} // 2
const test & operator+(int m) {} //3
private:
int n;
};
int main()
{
test t1 , t2, t3;
// this works fine t1 = t2.operator+(t3) , calls 2 and 1
t1 = t2 + t3;
// this works fine t1 = t2.operator+...
Could somebody please elaborate on the differences?
...