Skip to content

Get rid of “new” #868

Open
Open

Activity

  1. added
    good first issue
    on Dec 1, 2021
  2. v4hn commented on May 31, 2022

    @v4hn
    Contributor

    The examples you cite are obviously bad code either way.
    The first one uses new multiple times(?) for a temporary structure (because it would be/was back in the days too much for the stack?).
    If the function has to be reentrant that can make sense, but even then the style is horrible and should use one unique_ptr to a single allocated block instead.

    The second one could probably be replaced by a local JointConstraint and a emplace_back(std::move(...)) operation.
    But it is bad design to begin with to have multiple lists that should be consistent all hold shared_ptr ownership to the same data.

    It seems to me cleaning up the (/some of the) remaining new operators might be best done by reorganizing things in the datastructures themselves instead of replacing them by simple make_*() calls, so it might be better to look at a few of them only and think about how this can be avoided better by adapting the environment of the code.

  3. TanmayAgarwal123 commented on Jan 30, 2023

    @TanmayAgarwal123

    I would love to work on this project, can you assign me
    Regards,
    Tanmay Agarwal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions