[ 
https://issues.apache.org/jira/browse/THRIFT-5766?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jens Geyer resolved THRIFT-5766.
--------------------------------
    Fix Version/s: 0.21.0
       Resolution: Fixed

> 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
>            Assignee: Carel
>            Priority: Minor
>             Fix For: 0.21.0
>
>          Time Spent: 4h
>  Remaining Estimate: 0h
>
> 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 
> 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|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