At 09:08 PM 10/18/05 +0000, Guillermo Prandi wrote:
>Actually:
>
>char *f = "Hello";
>
>Left "Hello" in the ROM area. Whilst:
>
>char f[] = "Hello";
>
>Left "Hello" in the RAM area (after copying from ROM, of course).
>
>Guille
I rather suspect that's an allowed interpretation of the standard
then. GCC is quite good about that. It certainly follows the practice of
some UNIX compilers. Unfortunately that's a non-obvious type pun.
Thankfully lint (PC-Lint) catches it (although as a C++, not a C error,
Makes sense; AIUI the type of a string literal is different in the two
languages.)
char *f = "test";
e:\cygwin\home\radsett\newlib-lpc\test11.c 33 Info 1776: Converting a string
literal to char * is not const safe (initialization)
Thanks, another hole in my knowledge corrected.
Robert
" 'Freedom' has no meaning of itself. There are always restrictions, be
they legal, genetic, or physical. If you don't believe me, try to chew a
radio signal. " -- Kelvin Throop, III
http://www.aeolusdevelopment.com/Message
Re: [lpc2000] Re: Problems with sting constants and gcc -On
2005-10-18 by Robert Adsett
Attachments
- No local attachments were found for this message.