The C language defines the const variable in the header file

  • 2020-05-19 05:19:54
  • OfStack

The C language defines the const variable in the header file

There are no multivariate warnings or errors in defining const in a header file, which can waste rom space if the header file is included in large Numbers.

By looking at the expansion of the *.i file, you can see that each.i file has its own variable expansion.

View the *.map file to see multiple address assignments for this variable.

When precompiled if in the header file defines the const variables, each 1 c file contains the header files will be, but not at compile time error, because it conforms to the rules of grammar, each one contains the header file *. c files will be compiled once this variable, assign a new address, and wouldn't be an error in the link, because each variable with the same name has its own address space, although the program is running will not cause problems, but if the variable is much, can cause rom squandered

Thank you for reading, I hope to help you, thank you for your support of this site!


Related articles: