On 13-08-08 02:57, Peter Teoh wrote:
But since u have assigned it to the same address of NAME, it will always print HELLO world. So the whole thing has nothing got to do with optimization (gcc -O0 to disable it, which is also default).
Can y'all please just listen to Johannes? It definitely does. We have:
int main() { char *p_name = "santosh"; char *q_name = "santosh";
It is unspecified whether or not the compiler will allocate one or two copies of the character sequence "santosh" and therefore whether or not p_name != q_name;
Just replace it by
int main() { char *p_name = "santosh"; char *q_name = "peter";
to understand that allocating it just once is an optimization. Rene. -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ