If you use Qt and endl, you could accidentally use the wrong endl
, happened to me today and i was like ..WTF ??
#include <iostream>
#include <QtCore/QtCore>
#include <QtGui/QtGui>
//notice that i dont have a "using namespace std;"
int main(int argc, char** argv)
{
QApplication qapp(argc,argv);
QMainWindow mw;
mw.show();
std::clog << "Finished Execution !" << endl << "...";
// Line above printed: "Finished Execution !67006AB4..."
return qapp.exec();
}
Of course that was my mistake, since i should have written std::endl
, but if you use endl
, qt and using namespace std;
it depends on the order of the include files if the correct endl
will be used.
Of course you could recompile Qt to use a namespace.
EDIT: Forgot to mention, Qt's endl
is declared in "qtextstream.h" which is part of QtCore