Daved is right. If you're working with a lot of arrays or vectors and you go past the array bounds segfaults usually come well after the actual error. I was recently doing something like that myself...
Type: Posts; User: anykey
Daved is right. If you're working with a lot of arrays or vectors and you go past the array bounds segfaults usually come well after the actual error. I was recently doing something like that myself...
orbitz, thanks. valgrind looks useful.
I need it as cure rather than prevention, debugger sometimes doesn't tell you enough about the real location of error, especially in case of stack corruption.
Are there any utilities for Linux/Widows which check for array bound violations and possibly stack corruption in C++ programs?
Something like an emulation of runtime provided in other languages?...
Daved, thanks for the quick reply.
I'm unfortunately not very familiar with boost, but I like the idea with a list and a set. I think I could do something like this.
As far as history is concerned...
Here is a summary of my question:
I have a particular class
class Combination;
there is a function which generates objects of this class:
Combination makeCombination();
Brian, thanks!
Suppose I have some kind of structure:
typedef struct MyStruct {
int a;
}
will there be any difference in the execution time of this code:
Oh yes, I missed that.
Great minds think alike, huh? :D :D
Or you could have a member function reset() in your CMyClass which resets the class as you want.
Yes this code is hard to read.
First thing that really sticks out here is that the do-while loop uses (0<1) as a condition which is always true. Since you don't have any break exit or return...
laserlight, why do you have this line of code in your enlarge() function:
temp = 0;
?
memory allocated to temp has already been delete[]d and temp itself will go out of scope the next line of...
You could use std::multimap<char, COORD>.
Well psasidicrum in my (rather limited) experience it is hard to understand code without any kind of documentation unless its not very complex. If you download source code with hundreds of header and...
thanks, should have thought of that myself :o
purely out of curiosity, does anyone know the size of a pointer in memory (under Windows OS)?
hk_mp5kpdw (hope i got this right :) ) thanks a lot, that solves my problem.
'name' is an int, so should work fine.
Once again, thank you.
Hi,
I have a map of an object of a certain class and a vector of another class. I have an iterator for this map which I need to 'jump' several positions forward. Here is the relevant code:
...
Off the top of my head, here is a possible recursive algorithm for doing this. However, it is very inefficient and i think it stores differrent permutations of a same subset (e.g. it'll see {1, 2, 3}...
I guess that whenever you have a for loop you could do the same thing with a while loop and vice versa. But for a beginner, using a for loop when you have a predeterminate number of steps to perform...
It could be because of that, yes, since insertNode asks for a String* and you give it a char*. However, I haven't really worked with System::String before so I can't really say.
Also, this line of...
I might be stating the obvious but if you say the program crashes after you try to insert the first node into the BST, at this point the tree must be empty. So the problem must be in this code:
...
maro, do you have to use char* to store the name? If not, it would be a lot easier to use std::string instead.
Also, if you have to use an array, there is no need to delete the array, just...