bug-gnulib
[Top][All Lists]
Advanced

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

Re: getline vs linebuffer


From: Bruno Haible
Subject: Re: getline vs linebuffer
Date: Tue, 27 Sep 2011 00:13:56 +0200
User-agent: KMail/1.13.6 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.0; x86_64; ; )

Hi Reuben,

> Is linebuffer obsoleteable in the face of standardized getline and friends?

I'm not the maintainer of either of these modules, but I don't consider
'linebuffer' to be obsolete.

Whenever I have to understand the calling convention of getline(), I get dizzy.
What will happen if lineptr == NULL? And what if *lineptr == NULL? And what if
*lineptr != NULL but *linesize == 0? Can I pass the result of a getline() call
to another getline() call?

Whereas 'linebuffer', through its object-oriented design, is much easier to
understand: You call initbuffer(), and then readlinebuffer() will reuse the
buffer as best as it can.

Probably there are situations where getline() can be used and 'linebuffer'
is not suitable. But for those situations where 'linebuffer' is suitable
-- and I bet they are significant -- it is easier to use than getline().

Bruno
-- 
In memoriam Pavlos Bakoyannis <http://en.wikipedia.org/wiki/Pavlos_Bakoyannis>



reply via email to

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