As I know compiletime C-like strings are kept in static memory as only one instance. For instance I got both true
on gcc 4.6 running example below. But I wonder is it always true and can be portable. Behavior on both C and C++ is interesting.
#include <iostream>
bool amIportable(const char* value) {
const char* slocal = "Hello";
return (slocal==value);
}
int main() {
const char* s = "Hello";
std::cout << std::boolalpha
<< amIportable(s) << '\n'
<< amIportable("Hello") << '\n';
}