Re: race condition (sort of)? message box verus function return

Rainer Deyke <[email protected]> Tue, 14 Feb 2017 22:46:10 +0100
Newsgroups gmane.comp.lib.sdl
Message-ID <[email protected]>
On 13.02.2017 18:24, speartip wrote:
> std::cout<< horizontal <<"\t"<<std::flush<< vertical << "\t"<<std::flush<<endl;

'std::cout << std::endl' is equivalent to 'std::cout << '\n' << 
std::flush', so you're flushing three times here.  That's a bad idea 
because flushing slows down the program.  I recommend this:

   std::cout << horizontal << "\t" << vertical << "\t\n" << std::flush;

Flush exactly once, at the very end of your output, and always use 
'std::flush' instead of 'std::endl' because 'std::flush is more explicit 
about your intention.


-- 
Rainer Deyke - [email protected]