This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Hash table iterators.
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Andrew MacLeod <amacleod at redhat dot com>
- Cc: Lawrence Crowl <crowl at googlers dot com>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>, Diego Novillo <dnovillo at google dot com>
- Date: Sun, 25 Nov 2012 14:41:58 +0100
- Subject: Re: Hash table iterators.
- References: <CAGqM8faBBmZx9D62kUSHxCOCeP1TO2YzrA652Ti8rmZ=iUOpjg@mail.gmail.com> <CAGqM8fb6jQVZqbX7b9zPutvoea8-hQAQLDTg2XODRr6ey_Qw1A@mail.gmail.com> <50AFA126.2000801@redhat.com>
On Fri, Nov 23, 2012 at 5:15 PM, Andrew MacLeod <amacleod@redhat.com> wrote:
> On 11/22/2012 01:18 PM, Lawrence Crowl wrote:
>>
>> I have found that tree-flow.h implements iteration over htab_t,
>> while there is no current facility to do that with hash_table.
>> Unfortunately, the specific form does not match the standard C++
>> approach to iterators. We have several choices.
>>
>> (1) Ignore the problem and leave all such tables as htab_t.
>>
>> (2) Write new hash_table iteration functions to match the form of
>> the existing GCC macro/function approach.
>>
>> (3) Write new hash_table iteration functions to match the form used
>> by the C++ standard. This approach would entail modifying the loops.
>>
>> Diego and I have a preference for (3). What do you prefer?
>
>
> I don't like (1) for sure.
>
> Before deciding a preference between (2) and (3), what are the actual
> differences? ie, is (2) doing something practical that (3) has to bend
> over for, or is (3)'s format better but wasn't practical before? is (2)
> otherwise useful going forward?
I prefer (2) with internally using (3). I have such patch for the loop iterator
around (that takes care of disposing of the iterator via a destructor - so
no longer a need for the fancy BREAK_FROM_XXX stuff).
Richard.
> Andrew
>