c++ - Isn't std::endl redundant? -


flush happens in following cases:

  • std::cerr
  • std::cin
  • program termination
  • in many implementations, standard output line-buffered, meaning "\n" flushes anyway

so seems in regular programs, std::endl unnecessary, it's used everywhere.

so seems in regular programs, std::endl unnecessary, it's used everywhere.

no it's not redundant, since implementation of flushing along '\n' isn't mandated standard. that's implementation specific behavior, while behavior of std::endl defined.


Comments

Popular posts from this blog

c# - ajax - How to receive data both html and json from server? -

c# - SharpDX Toolkit models rendering inside out -