3 ms·
> cout << "Hello, C++!" << endl; For the love of god, please stop using endl. It performs a flush when "\n" is both valid and all that you ever want. Also wha
by josefx 9y ago
> cout << "Hello, C++!" << endl;
For the love of god, please stop using endl. It performs a flush when "\n" is both valid and all that you ever want.
Also what happened to the std:: prefix?
- ben0x539 9y agoAre you saying you never want to flush? If flushing after every line is good enough for printf then it's gonna be good enough for me~
- josefx 9y agoBuffering of Cs stdout is implementation defined. For Linux it is only line buffered in an interactive terminal session and fully buffered otherwise. > Are you saying you never want to flush? 90% of the time not. The other ten percent include asking for user input, which causes an implicit flush since std::cin is linked to std::cout, and debugging an ugly heisenbug.