Skip to content

Incorrect use of noexcept #1

@the-moisrex

Description

@the-moisrex
    std::string subsystem() const noexcept;
    std::string   devtype() const noexcept;
    std::string   syspath() const noexcept;
    std::string   sysname() const noexcept;
    std::string    sysnum() const noexcept;
    std::string   devnode() const noexcept;

std::string throws if it fails to allocate storage for it; marking it as noexcept will just call std::terminate directly instead I believe.

May I suggest returning std::string_view instead? The lifetime the strings are tied to udev_device I believe.

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