[Top][All Lists]

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

Re: Built-in printf Sits Awkwardly with UDP.

From: Bob Proulx
Subject: Re: Built-in printf Sits Awkwardly with UDP.
Date: Tue, 19 Jul 2011 10:48:38 -0600
User-agent: Mutt/1.5.21 (2010-09-15)

Ralph Corderoy wrote:
> ...  But a regular file ./foo on disk does look different and it
> still seems odd that
>     printf '\n\n\n\n\n\n\n\n\n\n\n\n' >foo
> does a dozen one-byte write(2)s.

But the only reason you know that there is a long string of newlines
is that your eye is looking over the entire string.  It has all of the
data all at once.  You have a non-causal relationship with the data
because you are looking over all of the past history of the data.  By
the time we see it here it has all already happened.  You are not
looking at the data as it arrives.

In other words...  Are you trying to suggest that a program should try
to look-ahead at future characters?  Characters that may not yet be
written yet?  That would be a cool trick of time travel to be able to
know what is going to happen in the future.  When you as the program
see a newline character do you know if the next character that has no
yet been generated yet will be a newline?  Should it wait a timeout
until characters have stopped appearing?

It really isn't a problem that can always be solved perfectly in every


reply via email to

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