[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] understanding groff's source code
From: |
Ulrich Lauther |
Subject: |
Re: [Groff] understanding groff's source code |
Date: |
Mon, 29 Sep 2014 18:25:50 +0200 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Mon, Sep 29, 2014 at 09:05:48AM +0100, Ralph Corderoy wrote:
> Hi Ulrich,
>
> > In case of questions, should one ask on the list
>
> I'd say ask here; answers would be part of the public record. These
> answers are all based on a quick look; I don't know they're correct.
>
> > However, not so for extract().
>
> node *node_list::extract()
> {
> node *temp = head;
> head = tail = 0;
> return temp;
> }
>
> The list is extracted, not a node; a pointer to the first element, if
> any, is returned. The caller can walk the list themselves. The
> node_list forgets about those elements.
>
Thanks for the explanation!
Things would be easier if there were minimal comments, like so:
class node_list { // a singly linked list of nodes
void node_list::append(node *n)
// appends node n to the list
node *node_list::extract()
// removes all elements from the list, which thus becomes empty.
// returns a chain of nodes that had been in the list, i.e., the first
// element of that chain, or zero if the list was empty.
> Cheers,
ulrich