Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
0.19.0
-
None
Description
Remove the usage of std::endl to force new lines for std::ostream
Rationale
- Using `std::endl` for linebreaks is bad practice since std::endl also forces a stream flush.
- A past Ticket
THRIFT-1815identified the flush component as a problem and the behavior of std::endl was replaced with a custom constant that only did the new line to minimize code changes. - This enforces bad practice and changes expected behaviour
- The C++ Core Guidelines SL.io.50 also suggest that std::endl should be avoided
I propose (by PR) to remove the usage of endl and instead use \n directly to avoid building on the bad practice.
See: https://github.com/apache/thrift/pull/2943
- Replace the usage of endl with "\n" in all genertors
- Replace the usage in most test files and examples
- Keep the usage in std::cerr
Attachments
Issue Links
- relates to
-
THRIFT-1815 Code generators line buffer output
- Closed
- links to