Closed vittorioromeo closed 4 years ago
With these changes one could argue that the same should be applied to all chapters, with the exception of debug callback messages since the flushing would result in a more predictable debugging experience there. What do you think?
I would generally agree with that approach. \n
should be your default, and std::endl
should be used only when you want to ensure the message is immediately flushed to the console (or a file).
Rationale:
"Default initialization" actually means not initializing the object, which would leave it uninitialized. Using
= {}
is "aggregate initialization" syntax, which leads to "value initialization". Directly using{}
is just "value initialization".std::endl
is overused and can be a source of performance issues, as it forces the output buffer to be flushed.\n
is - most of the times - what you need. Just doing my part in trying to avoid overuse ofstd::endl
.