I've seen this in C/C++ code:
char * GetName()
{
return "Aurian";
}
What is exactly going on here under the hood? Where in memory is "Aurian" stored such that it survives when I leave the GetName() scope, AND I get a char * to it? I'm guessing it doesn't follow the same rules as say, returning an int. And how does this relate to
char * name = "Aurian";
Is this implementation dependant? Also, would GetName() just be compiled away to just "Aurian"?
This thread seems to suggest that some sort of jump table might be used for all string literals, for GCC anyway.