Skip to content

Cannot perform static_assert in C++ on header files generated by pioasm #2650

@rhulme

Description

@rhulme

Because the pio_program structure is not declared constexpr, it's not possible to perform compile-time checks on the contents.

In my project, I have a couple of PIO programs that I would like to ensure both fit in a single PIO instance (i.e. in the 32-word memory) and discover at compile-time if changes are made that would prevent this, rather than with a panic at run-time.

Obviously, constexpr is a C++ keyword so can't be used if the header file is included from a plain C file, but the keyword to use can be determined via checking whether __cplusplus is defined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions