Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encode constants with const, not #define #158

Open
ollie-etl opened this issue May 18, 2021 · 1 comment
Open

Encode constants with const, not #define #158

ollie-etl opened this issue May 18, 2021 · 1 comment
Labels

Comments

@ollie-etl
Copy link

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.

@github-actions
Copy link

This issue has been marked as a stale issue because it has been open (more than) 45 days with no activity.

@github-actions github-actions bot added the Stale label Oct 15, 2023
@arnopo arnopo reopened this Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants