On 05/14/2012 03:04 PM, Cristian Rodríguez wrote:
El 14/05/12 14:59, David C. Rankin escribió:
On 05/11/2012 05:10 PM, Cristian Rodríguez wrote:
El 11/05/12 15:06, David C. Rankin escribió:
All seem to do the same thing??
Please read www.akkadia.org/drepper/dsohowto.pdf section 2.4 to know the difference.
Oops, sorry Christian -- you will get 2 -- forgot to change the address...
Grr... Thank you! If I understood what I read, then for the benefit of those that didn't read it: char *str = "foo"; and char str[] = "foo"; are NOT the same thing. The meaningful difference, according to Drepper, being that the first declaration creates a variable named 'str' with its initial value being a 'pointer to' the string "foo". This requires the use of a variable in the non-sharable data segment and a relocation to initialize it with the pointer. The second declaration of char str[] = "foo"; simply creates a name for the sequence of bytes that initially contain "foo". The name for the sequence of bytes is not variable and cannot change, it is 'str' forever. Of course the bytes pointed to by 'str' can change. That is all new to me. Thank you Christian. When given the option to initialize with char *str or char str[], it shall be char str[] from now on. -- David C. Rankin, J.D.,P.E. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org