I'm a bit confused about this:
I thought that if a pointer points to some object, assigning a dereference to some reference variable was a mere aliasing.
Example:
Object * p = &o;
Object & r = *p;
// r and o are the same object
I was aware there was some illegal cases, like:
Object * p = NULL;
Object & r = *p; // illegal
Now, what about the code below ?
const char * p = "some string";
const char & r = *p;
or
const char & r = *"some string";
I was said that this particular case involved temporary objects and, therefore I could'nt get the address of r and be sure it will point to a memory array containing my initial string.
What does C++ standard states about that case ? Is it another illegal case like the NULL provision, or is it allowed behavior.
In other words, is it legal or illegal (undefined behavior ?) to write something like ?
char buffer[100];
strcpy(buffer, &r);