[Top][All Lists]

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

Re: [PATCH] Improved string writing

From: Ludovic Courtès
Subject: Re: [PATCH] Improved string writing
Date: Thu, 21 Apr 2005 09:37:31 +0200
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)


Kevin Ryde <address@hidden> writes:

> What happened to the port buffering?

Indeed, it occurred to me that this is easily fixed by making the port
line-buffered with `setvbuf'...

Actually, I hadn't considered using it because `stdout' is line-buffered
by default, at least on GNU/Linux (SUSv2 states that it shall be
"fully-buffered" by default [1, 2]).  But it looks like Guile's file
ports are unbuffered by default.  Maybe _this_ should be changed?

> That doesn't sound like a good place.

Well, this is not user-visible buffering, just an internal optimization.
It looks better to call `scm_lfwrite ()' once than `scm_putc ()' for
each character, especially since `scm_putc ()' calls `scm_lfwrite ()'
which in turn calls the write method of this port's type, etc.  So, IMO,
this change may still be valuable.

> For the fixed parts of the format string it probably does that to keep
> track of the output column, something it should let the port do.

`scm_lfwrite ()' does this so Guile code doesn't have to care about it.



reply via email to

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