Skip to content

Constructing a string_view from string literal uses a call to strlen #107

@rmn30

Description

@rmn30

The following code will emit a call to strlen:

std::string_view a {"hello"};

This is a bit surprising because it could be evaluated at compile time. It's slightly annoying because it might require adding the 'strings' library on CHERIoT and obviously is slightly suboptimal from a performance point of view. Using a string_view literal doesn't require this call e.g.

using namespace std::literals;
std::string_view a {"hello"sv};

This is by no means urgent and may be an upstream issue but thought it worth noting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions