Skip to content

Encode constants with const, not #define #158

@ollie-etl

Description

@ollie-etl

The issue is created to record the const aspect of #156. The motivations remain as that issue.

Some points on the effect of using const in place of #define

  • Symbols for the constants will be included in library. This increases the size of the library.
  • This is only of concern in systems with both using dynamic linkage and with tight space constraints.
  • There are 640 #defines (in total) in the codebase. This should bound the upper limit on the effect on size to a few kB.

Many of the constants could better be represented as enums, for increased type safety. This has a larger impact on codebases using libmetal, so such a refactoring should be considered as a seperate issue.

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