[fpc-devel] ConsoleIO and flushing buffered output

Christo Crause christo.crause at gmail.com
Tue Jun 9 08:55:08 CEST 2020


On Tue, Jun 9, 2020 at 12:03 AM Michael Van Canneyt <michael at freepascal.org>
wrote:

> Could you please submit a patch with this modification to the bugtracker ?
>
> We don't as a rule follow up on such things in github.
>

I will of course submit a patch once I'm satisfied it is good enough.  My
concern with the current patch is that a low level flush is called after
every write statement, so a simple loop like the following:

for c := 'A' to 'Z" do write(c);

will incur the burden of a low level flush after each iteration.  In normal
use the low level flush call is not needed and causes unnecessary blocks.
This is what Tomas mentioned, so I'm looking for a different implementation
that can fit in with the rest of the use cases in the RTL.

It would make more sense to me if there was a distinct difference in use
case between InOutFunc and FlushFunc (for fmoutput case), to my naive view
it seems as if they are mostly used interchangeably and in many cases even
share the same implementation function.  This makes sense for the
traditional targets (Windows, Linux etc.), but for lower level targets a
distinction between the internal RTL buffer and the external OS/hardware
buffer is useful. For a low level target I would think an InOutfunc that
flushes the internal buffer to the OS/hardware and a FlushFunc that ensures
the internal buffer is empty and then blocks until the OS/hardware has
completed transmission would make sense.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20200609/07a08e1a/attachment-0001.htm>


More information about the fpc-devel mailing list