Carel created THRIFT-5766:
-----------------------------

             Summary: Replace std::endl with "\n"
                 Key: THRIFT-5766
                 URL: https://issues.apache.org/jira/browse/THRIFT-5766
             Project: Thrift
          Issue Type: Improvement
          Components: Compiler (General)
    Affects Versions: 0.19.0
            Reporter: Carel


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-1815 identified the flush component as a problem and 
instead of a proper fix the behavior of {{std::endl}} was replaced with a 
custom constant that only did the new line.
 * This enforces bad practice and changes expected behaviour
 * The [C++ Core Guidelines 
SL.io.50|https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#slio50-avoid-endl]
 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}}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to