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

Will const variables always exist in program space? #967

Open
Ebola-Chan-bot opened this issue Feb 8, 2024 · 0 comments
Open

Will const variables always exist in program space? #967

Ebola-Chan-bot opened this issue Feb 8, 2024 · 0 comments
Labels

Comments

@Ebola-Chan-bot
Copy link

Language/Variables/Utilities/PROGMEM.adoc says:

Newer boards (Due, MKR WiFi 1010, GIGA R1 WiFi etc.) automatically use the program space when a variable is declared as a const.

As far as I know, program space is not writable at runtime. However, const variables can be initialized at runtime. Is there a contradiction?

A more plausible possibility is that only constexpr is guaranteed to be placed in program space, leaving the other variables to the compiler to decide whether to optimize them into program space.

@per1234 per1234 added the bug label Feb 27, 2024
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