Skip to content
This repository was archived by the owner on Aug 24, 2020. It is now read-only.
This repository was archived by the owner on Aug 24, 2020. It is now read-only.

C++ migration: Object lifetimes #12

Description

@davidgraeff

Wakaama uses structs a lot. But because C lacks constructors and destructors, a lot of boilerplate code just allocates/inits/deinits/frees those structs in various success and error code paths.

  • The use of proper classes with constructors/destructors solves object lifetime tracking.
  • The use of unique_ptr, shared_ptr reduces explicit destructor requirements
  • The use of string_view (C++ backport, use of C++14 native if available) / string instead of raw const char* pointers make it obvious which string are owned by a structure

See https://github.com/martinmoene/string-view-lite

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions