the \n is completely unnecessary. std::endl does exactly the same thing, and is portable. on all platforms it will be the endline character(s) for the current platform. on some it's \r\n, and others it's just \n. what's interesting is that in that line, the program is making several function calls behind the scenes. it's writing "In main thread." to std::cout, and then it's writing std::endl. this means that the thread scheduler can interrupt between them, and you could get something else printed between "In main thread." and std::endl, unless you're using mutexes.