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# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -