We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I have a few source files in which some const variables are required (same for all of those source file).
In the provided framework there is a .hpp header file that includes definitions (not only declarations) of those variables and this header is included in my source files mentioned before.
Then I realized, that each of my source files contains a copy of that RO data const variable, so in order to reduce memory footprint I made one more .hpp that is included in my source files and which contains extern references to those variables (included somewhere else) without actual variables.
I compared build .o object information provided below:
(note: RW, ZI removed)
Not using externs, using actual variables:
Code: 1192
(inc. data): 84
RO Data: 144
Using externs without actual variables:
Code: 1392
(inc. data): 216
1) Why code size increased?
2) Why inc. data increased?
3) In this case, why RO (const data) size didn't change?
4) What is inc. data in this scope?