[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 5/5] style: don't use std::endl

From: Hans Åberg
Subject: Re: [PATCH 5/5] style: don't use std::endl
Date: Wed, 9 May 2018 10:46:38 +0200

> On 9 May 2018, at 08:18, Akim Demaille <address@hidden> wrote:
>> Le 8 mai 2018 à 18:03, Hans Åberg <address@hidden> a écrit :
>>> On 8 May 2018, at 17:02, Akim Demaille <address@hidden> wrote:
>>> Don't use std::endl, it flushes uselessly, and is considered bad
>>> style.
>> Flushing is good with debugging and error reporting, though.
> I agree, but in that case an explicit `flush()` is better.
> And in the case of Bison, I don’t think we need any.
> Besides, stdout is typically line buffered when connected to a terminal,
> and stderr is typically unbuffered.

Testing on MacOS 10.13.4 with clang++ in a debugger, I could not see no 
difference: the stuff gets output immediately, regardless of flushing and 

On a POSIX computer, C streams are tied to the file descriptors, and C++ 
streams are internally tied to those of C, so they probably just use the POSIX 
buffers. At least GCC and Clang do: the file descriptors can be extracted from 
C++, too.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]