Skip to content

Consider adding a C API #4663

@vitaut

Description

@vitaut

There is a well-defined binary interface between top-level functions such as fmt::format and their type-erased counterparts like fmt::vformat. This interface relies only on basic C++ features and should be compatible with C (except for the overload returning std::string obviously). As a result, it may be possible to provide a C API that builds argument lists using _Generic and invokes the type-erased functions.

Unlike the printf family of functions, such an API could be fully type-safe, including for runtime format strings, and would not rely on encoding type information in the format string itself.

This issue is opened to gauge interest. React with a 👍 or another emoji if you would use this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions