Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Weimin Pan <weimin.pan@oracle.com>
Cc: qiyaoltc@gmail.com, jose.marchesi@oracle.com, gdb-patches@sourceware.org
Subject: Re: [PATCH v4] gdb: ADI support
Date: Tue, 25 Jul 2017 20:18:00 -0000	[thread overview]
Message-ID: <bda84954ed7ac2d863cc9f7dfbf92b6c@polymtl.ca> (raw)
In-Reply-To: <46b97822-c3a8-4ed7-ab1c-fa0a932d4007@default>

On 2017-07-25 21:19, Weimin Pan wrote:
> ----- Original Message -----
>> From: qiyaoltc@gmail.com
>> To: jose.marchesi@oracle.com
>> Cc: weimin.pan@oracle.com, gdb-patches@sourceware.org
>> Sent: Tuesday, July 25, 2017 9:44:55 AM GMT -08:00 US/Canada Pacific
>> Subject: Re: [PATCH v4] gdb: ADI support
>> 
>> jose.marchesi@oracle.com (Jose E. Marchesi) writes:
>> 
>> > General question: what's wrong with using a simple linked list of
>> > structs if that is the developer's preference, and/or it follows the
>> > current style of the surrounding code?  (Not saying it is in this case,
>> > that's up to Weimin to say.)
>> 
>> It makes the code a little bit unnecessarily complicated, IOW, 
>> std::list
>> or std::forward_list can make it simpler.  My preference is to use
>> standard c++ data structure rather than re-inventing it again.
> 
> Obviously I missed your comment of using std::list but it's not clear 
> to me why
> you think a simple linked list can be a little bit unnecessarily 
> complicated.

First, as Yao said, using a home-made linked list is like re-inventing 
the wheel.  It is more complex to review/read code that plays with 
pointers and pointers to pointers than one that uses standard APIs like 
push_back or remove/remove_if.  It's also less boilerplate code, so less 
noise around the code that actually does what we want.

Also, for some time we have been moving slowly but surely towards RAII 
for managing memory (and other resources).  In my opinion, it has helped 
a lot to clean up some parts of the code, and using C++ containers plays 
a big role in that.  I think it makes sense that we try to aim for that 
in the new code, otherwise it's just more things we'll need to change in 
the future.

> 
> Given the fact that we need to backport this new feature to older 
> gdb's, e.g.
> dev-toolset6, one question is do we need to resort to the linked list 
> solution
> if the std list implementation is not available in older gdb versions?
> As of now,
> we have one diversion already -  uiout->text ("\n") VS ui_out_text
> (uiout, "\n").

Are you talking about Red Hat devtoolset?  If so, it seems like it 
contains gdb 7.12.  As far as I remember, it was possible to build 7.12 
in both C and C++ mode.  If you don't need to maintain the ability to 
build as C, you should be able to backport a patch using std::list.

Thanks,

Simon


  reply	other threads:[~2017-07-25 20:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-25 19:19 Weimin Pan
2017-07-25 20:18 ` Simon Marchi [this message]
2017-07-25 21:03   ` Jose E. Marchesi
  -- strict thread matches above, loose matches on Subject: below --
2017-08-04 22:46 Weimin Pan
2017-08-01 23:30 Weimin Pan
2017-08-02  7:55 ` Yao Qi
2017-08-02 18:00   ` Wei-min Pan
2017-08-04 11:57     ` Yao Qi
2017-07-25 22:37 Weimin Pan
2017-07-19  0:49 Weimin Pan
2017-07-25 15:16 ` Yao Qi
2017-07-25 15:31   ` Jose E. Marchesi
2017-07-25 16:44     ` Yao Qi
2017-07-26 21:12   ` Wei-min Pan
2017-07-27 11:17     ` Yao Qi
2017-07-27 16:34       ` Wei-min Pan
2017-07-28 10:30         ` Yao Qi
2017-07-28 16:34           ` Wei-min Pan
     [not found]             ` <868tj3ml8s.fsf@gmail.com>
2017-08-01 17:41               ` Wei-min Pan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bda84954ed7ac2d863cc9f7dfbf92b6c@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=jose.marchesi@oracle.com \
    --cc=qiyaoltc@gmail.com \
    --cc=weimin.pan@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox