Original Post
some time ago, i wrote a string class. today in one of its methods, the application suddenly crashed... i didn''t have problems with the string class for months now, so this seemed strange to me. after hours of debugging, i still could not make out a bug.
so i rewrote a part of a function in my app, in which the string was used & crashed. suddenly the problem was gone... i looked a bit closer at my code and noticed, that there was a small difference :
original (crashing on return):
void myFunction(const String &dir)
{
String directory = dir;
directory.insert(directory.GetLength(), ''/'');
}
''copy'' (working):
void myFunction(const String &dir)
{
String directory;
directory = dir; // <<< ??
directory.insert(directory.GetLength(), ''/'');
}
so what does that mean ?? shouldn''t the first method be exactly the same, as the second one ?