[RTEMS Project] #4376: covoar/ReportsBase Coverage::GenerateReports() uses raw pointer to std::list (was: covoar/ReportsBase Coverage::GenerateReports() uses raw pointer std::list)

RTEMS trac trac at rtems.org
Mon Apr 5 18:35:16 UTC 2021


#4376: covoar/ReportsBase Coverage::GenerateReports() uses raw pointer to
std::list
------------------------------+---------------------
 Reporter:  Alex White        |       Owner:  (none)
     Type:  defect            |      Status:  new
 Priority:  normal            |   Milestone:  6.1
Component:  tool              |     Version:  6
 Severity:  normal            |  Resolution:
 Keywords:  coverage, covoar  |  Blocked By:
 Blocking:                    |
------------------------------+---------------------
Changes (by Joel Sherrill):

 * keywords:  coverage => coverage, covoar
 * component:  admin => tool


Old description:

> The `Coverage::GenerateReports()` function uses an `std::list<ReportsBase
> *>` to store the `ReportsBase`-derived classes used to generate the
> reports. The function should use an
> `std::vector<std::unique_ptr<ReportsBase>>` instead.
>
> An `std::vector` is the preferred container type in this case because the
> constant-time insertion and removal properties of `std::list` are not
> needed. The smart pointer type `std::unique_ptr<ReportsBase>` is
> preferred over `ReportsBase *` because it eliminates the need for manual
> pointer deletion at the end of the function.

New description:

 The `Coverage::GenerateReports()` function uses a variable of type
 `std::list<ReportsBase *>` to store the `ReportsBase`-derived classes used
 to generate the reports. The function should use an
 `std::vector<std::unique_ptr<ReportsBase>>` instead.

 An `std::vector` is the preferred container type in this case because the
 constant-time insertion and removal properties of `std::list` are not
 needed. The smart pointer type `std::unique_ptr<ReportsBase>` is preferred
 over `ReportsBase *` because it eliminates the need for manual pointer
 deletion at the end of the function.

--

--
Ticket URL: <http://devel.rtems.org/ticket/4376#comment:1>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list