C51: CONST VARIABLE STORAGE LOCATION
Information in this article applies to:
When I declare a constant like this:
const char c = 42;
Most compilers would place the resultant byte in the code segment. C51 seems to place it in the data segment. I realize I could simply write:
const char code c = 42;
But I'm curious as to why the const qualifier isn't enough on its own.
The const qualifier tells the compiler that the variable cannot be written (is constant). This has no influence on the memory space where the variable is located. You can define a constant variable in every memory space (data, idata, xdata ...). If you omit the memory space then the default memory space is used, which depends on the memory model chosen.
The following Discussion Forum threads may provide information related to this topic.
Last Reviewed: Friday, May 26, 2000
of your data.