Subject: Re: toolchain/22118: make won't compile with -Wcast-qual -Wstrict-prototypes and more
To: NetBSD Toolchain Technical Discussion List <tech-toolchain@NetBSD.ORG>
From: Ian Lance Taylor <ian@airs.com>
List: tech-toolchain
Date: 07/14/2003 17:37:46
"Greg A. Woods" <woods@weird.com> writes:

> Finally your/my hack with ``char foo[] = "string";'' only fools GCC --
> it's not a proper or portable fix since if I understand correctly (I may
> be wrong as I'm no GCC internals expert!) it doesn't really de-const the
> string constant that your "foo" will point to.  Only -fwritable-strings
> will do that (at least with GCC), and unfortunately it does it for the
> whole module, not just one string constant.

Using `char foo[] = "string"' does de-const the string.  It creates a
modifiable array, and initializes it with the string constant.  The
string winds up in .data rather than .rodata.

Ian