Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-07

Flush(StdOut) doesn't mean Flush(Output)

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

leledumbo

In the rtl documentation, StdOut is defined as an alias for Output. Therefore, (I think) flushing one will also flush the other. But the truth, it's not. In fact, only Flush(Output) will really flush standard output. So, what will Flush(StdOut) do?

PS: This might apply to StdErr (and StdIn, but I don't find StdIn), too.

View this message in context: http://www.nabble.com/Flush%28StdOut%29-doesn%27t-mean-Flush%28Output%29-tp18311722p18311722.html Sent from the Free Pascal - General mailing list .
Tomas Hajny
to leledumbo
leledumbo wrote 7 lines
In the rtl documentation, StdOut is defined as an alias for Output. Therefore, (I think) flushing one will also flush the other. But the truth, it's not. In fact, only Flush(Output) will really flush standard output. So, what will Flush(StdOut) do?

Obviously, it would flush everything written to StdOut file (which is normally associated with the same system handle as Output, but treated as a different file in our RTL).

You are absolutely right that our documentation is not aligned with the current implementation. The question is, what we really want or need (either side may be changed). Does anybody see particular benefits of the current implementation (i.e. having two independent files for each of stdout system handle and two independent files for stderr)?

PS: This might apply to StdErr (and StdIn, but I don't find StdIn), too.

It would indeed apply to StdErr and ErrOutput too.

Tomas

Tomas Hajny
to leledumbo
leledumbo wrote
So, what's the purpose of having them?

That's the part I could not answer myself and asked others who could remember the reasons for introducing it. There may have been technical reasons like support for "absolute" keyword (which could support a real alias) missing with some targets/platforms, or some reasons why there should be two distinct text files with their own buffers, possibly different I/O handlers and using different output device/handle.

Tomas