Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

c++ strings

Name: Anonymous 2007-03-21 6:35 ID:QUPvos6j

I'm not sure about how allocation and cleanup works with c++ strings. Does this leak memory?


string get_filename(char * path)
{
    string file_name = path;
    int pos = file_name.find_last_of('\\');
    if (pos!=string::npos)
    {
        file_name = file_name.substr(pos+1); // what happens to the memory here?
    }
    return file_name;
}

Name: Anonymous 2007-03-22 16:45 ID:bqviS+Fx

>>31

C++ programs are NOT slower than Java; not even by a long shot. Really poorly written C++ programs MIGHT run slower than well written Java programs, but there is NO chance for the exact same program written in C++ and ported to Java to run at the same speed or greater on Java (there MIGHT be some exceptions where Java would run at about the same speed as C++ using JIC, but even in this case, it is few and far between). People who understand the difference between compilers and interpreters are more than welcome to respond; the rest can weld their mouths shut.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List