This is the mail archive of the
mailing list for the GCC project.
Re: can we rename vec<>.safe_push() to vec<>.push()?
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: GCC Mailing List <gcc at gcc dot gnu dot org>
- Date: Thu, 31 Aug 2017 07:41:59 -0400
- Subject: Re: can we rename vec<>.safe_push() to vec<>.push()?
- Authentication-results: sourceware.org; auth=none
- References: <CAGm3qMUfS4x+Urp5qc0JVMqpFEiRxk-WJWCUzXOa0t1a8QpW0g@mail.gmail.com> <CAFiYyc3cgKgckdceZ5PFSj=wUE0ObywCkZhP8h-hSP0Jvt3JPg@mail.gmail.com>
So.... ok to default to a lazy one, or are suggesting we leave things
as they are?
On Thu, Aug 31, 2017 at 7:38 AM, Richard Biener
> On Thu, Aug 31, 2017 at 1:31 PM, Aldy Hernandez <firstname.lastname@example.org> wrote:
>> I understand the need for .quick_push(), when we know the size of the
>> allocated elements before hand, but do we really need to call the
>> common variant safe_push? Can't we just call it push()?
>> Or is there some magic C++ rule/idiom that prohibits us from doing this?
>> I volunteer to provide a patch if y'all agree.
> I think having quick_push and safe_push makes you think which one to use
> while push would be the obvious lazy one. Aka nobody thinks of pre-allocating
> stuff and using quick_push anymore.
> Just my 2 cents...