Skip to main content
Spelling and grammar
Source Link
Toby Speight
  • 88.3k
  • 14
  • 104
  • 327

One of the main problemproblems of cout is that it is not suitable for multithreading logging, as characters from different prints might interleave. It can be fixed without syntax change with(with some trickery) by making streaming operation return a handle that can be further streamed, and that locks loggersthe logger's mutex in constructor and releases in destructor.

The other problem is that cout is inconvenient for logging, as its formatting is poorly designed to begin with. Checkout fmtCheck out the fmt open source library for better alternatives. It'sIts primary function, format, is included in C++20.

One of main problem of cout is that is not suitable for multithreading logging as characters from different prints might interleave. It can be fixed without syntax change with some trickery by making streaming operation return a handle that can be further streamed that locks loggers mutex in constructor and releases in destructor.

The other problem is that cout is inconvenient for logging as its formatting is poorly designed to begin with. Checkout fmt open source library for better alternatives. It's primary function format is included in C++20.

One of the main problems of cout is that it is not suitable for multithreading logging, as characters from different prints might interleave. It can be fixed without syntax change (with some trickery) by making streaming operation return a handle that can be further streamed, and that locks the logger's mutex in constructor and releases in destructor.

The other problem is that cout is inconvenient for logging, as its formatting is poorly designed to begin with. Check out the fmt open source library for better alternatives. Its primary function, format, is included in C++20.

Source Link
ALX23z
  • 2.5k
  • 7
  • 15

One of main problem of cout is that is not suitable for multithreading logging as characters from different prints might interleave. It can be fixed without syntax change with some trickery by making streaming operation return a handle that can be further streamed that locks loggers mutex in constructor and releases in destructor.

The other problem is that cout is inconvenient for logging as its formatting is poorly designed to begin with. Checkout fmt open source library for better alternatives. It's primary function format is included in C++20.