[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Add gl_list_remove_last to list/xlist
From: |
Marc Nieper-Wißkirchen |
Subject: |
Re: Add gl_list_remove_last to list/xlist |
Date: |
Wed, 3 Jun 2020 23:22:37 +0200 |
Am Mi., 3. Juni 2020 um 23:08 Uhr schrieb Bruno Haible <bruno@clisp.org>:
> It's rarely used: In most cases, a list is either traversed one way or
> the other way.
One could say that a list that is to be transversed in both ways is a
different abstract data type; nevertheless, they appear (e.g. lists of
instructions in compiler analysis usually have to traversed in both
ways).
> If a list going to be traversed in reverse order, the programmer can just
> keep it in opposite order and use the normal forward iterator.
> Or they can use an array (or an array-based list) and use indices.
For an array-based list, this is fine. For a general list, one could
use gl_list_previous_node; however, one would have to keep a node of
the last element (there's no gl_list_first_node/gl_list_last_node).
> I find the amount of bloat in the C++ standard library horrible. In C
> at least, we can concentrate on the things that get used, not on the
> things that some rare programmer might find useful some day.
I admit that there is some wisdom in these words. :)