I am trying to overload the global operator new and delete for a performance sensitive application. I have read the concerns described at http://www.informit.com/articles/article.aspx?p=30642&seqNum=3 and the recommendations to use Intel TBB's allocator http://www.intel.com/technology/itj/2007/v11i4/5-foundations/5-memory.htm
Since...
Our management has recently been talking to some people selling C++ static analysis tools. Of course the sales people say they will find tons of bugs, but I'm skeptical.
How do such tools work in the real world? Do they find real bugs? Do they help more junior programmers learn?
Are they worth the trouble?
...
How do you disable CBitmapButton? I tried using m_bitmapbutton.EnableWindow(false); but it doesn't work. It still fires an event.
What I'm trying to do is prevent Button A from firing Event A if Event B is executing (from Button B). So in Event B, I want to disable Button A.
...
Is it possible to connect to SQLite in C++ and using ODBC API without register the database in ODBC?
I have code that uses ODBC talking to databases and don't want to rewrite for using SQLite and don’t want to register new ODBC connections.
...
I am curious about prevalent methodologies.
I found myself doing both of these things interchangeably:
Note in all cases the object is allocated locally.
std::string GetDescription ()
{
std::string desc;
/* Create a description */
return desc;
}
void GetResult (map<int, double> & resultMap)
{
/*Fill map r...
I have a very trival option processing function and i need to enter this function every so often. So i cant allocate the vector. I need to be able to add an element to the vector and save it so when i do come back to this function it is still their.
vector<sStruct> * loadFile(char *myTextFile)
{
myStruct
sStruct;
vecto...
Ok, I'm having issues with the linker on my current project (This is a continuation of another question, ish)
Basically, the linker gives an undefined reference in dynamiclib.so for:
std::basic_ostream<char, std::char_traits<char> >& SparseImplementationLib::operator<< <double, double, SparseImplementationLib::DefaultPtr<double, double>...
I generate a texture like this:
GLuint id;
glGenTextures(1, &id);
glBindTexture(GL_TEXTURE_2D, id);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,...
I'm learning c++ and QT and would like to be able to launch windows from a console application. Is this even possible?
...
Many of my c++ objects implement rerfrence counting through AddRef and FreeRef methods. If FreeRef reduces the refrence count to 0 then the object deletes its self.
All methods which return a refrence counted object dont increment the refrence. This makes it simple since a smart pointer can then simply increment the count apon recieving...
hi, I am currently working on a data visualization project.My aim is to produce contour lines ,in other words iso-lines, from gridded data.Data can be temperature, weather data or any kind of other environmental parameters but only condition is it must be regularly spaced.
I searched in internet , however i could not find a good algorith...
We just got a new developer and I'm trying to set him up with Dev Studio 2005 (The version we all use at this office), and we're running into a weird problem that I've never seen before.
I have some code that works perfectly on my system, and he can't seem to get it compiled. We've tracked the issue down to his copy of dev studio ign...
Given (in C++)
char * byte_sequence;
size_t byte_sequence_length;
char * buffer;
size_t N;
Assuming byte_sequence and byte_sequence_length are initialized to some arbitrary length sequence of bytes (and its length), and buffer is initialized to point to N * byte_sequence_length bytes, what would be the easiest way to replicate the byt...
I know that C++ has the concept of objects but C doesn't. I also know that pretty much all there is to know about C fits into K & R but the C++ library is vastly more complex. There have got to be other big differences though.
What are the major differences between C and C++?
...
I cannot find this question on stockoverflow. But I am wondering how people use STL (No fancy boost)... just an ol' fashion STL. Tricks/tips/mostly used cases acquired over many, many years... and perhaps gotchas...
Let's share it...
One tip per answer...with code example --
Edit is it such a bad question as it resulting in downvotes...
I want to fill these containers pretty quickly with some data for testing. What are the best and quick ways to do that? It shouldn't be too convoluted, and thus and inhumanly short, but also NOT to verbose
Edit
Guys I thought you can do something with memset knowning that vector has an underlining array?
Also, what about map?
...
I am looking to optimize reading/writing huge data for a C++ simulation application. The data termed as a "map" essentially consists of integers, doubles, floats and a single enum. A majority of this map data is fixed in size but a small part of it can vary
(from a few to several KB) in size. Several such maps (typically millions) are c...
Now that my OpenGL application is getting larger and more complex, I am noticing that it's also getting a little slow on very low-end systems such as Netbooks. In Java, I am able to get around this by drawing to a BufferedImage then drawing that to the screen and updating the cached render every one in a while. How would I go about doing...
I'm trying to collect information from a textfile which contains names of organisations (without spaces) and floating integers. I want to store this information in an array structure.
The problem I'm having so far is collecting the information. Here is a sample of the textfile:
CBA 12.3 4.5 7.5 2.9 4.1
TLS ...
Pointers present some special problems for overload resolution.
Say for example,
void f(int* x) { ... }
void f(char* x) { ...}
int main()
{
f(0);
}
What is wrong with calling f(0)? How can I fix the function call for f(0)?
...