I have been wondering if there is any difference between what is being pointed by ptrToArray
and ptrToLiteral
in the following example:
constexpr char constExprArray[] = "hello";
const char* ptrToArray = constExprArray;
const char* ptrToLiteral = "hello";
- Is my understanding that
constExprArray
and the two"hello"
literals are all compile time constant lvalues correct? - If so, is there any difference in how they are stored in the executable file, or is it purely compiler implementation or platform specific?
- Are they treated differently at runtime behind the scenes?
- Anything else to know about?