In ens.mailing-lists.linux-kernel, you wrote:
>
>Here's the story:
>
> struct thing
> {
> char *s;
> int i;
> };
>
> struct thing t1 = { "foo", 4 };
> struct thing t2 = { "foo", 4 };
>
>Compiled normally this will put a single instance of "foo" into the
>read-only data section .rodata.
>
>Compiled with '-fwritable-strings' the compiler will put _two_ copies of
>"foo" into the writable data section .data.
>
>However I'm not sure this is a good idea - it will prevent quite a bit
>of (usually desirable) string sharing. One embedded systems the .data
>section would have to be copied out to RAM at boot, so
>-fwritable-strings will use more RAM.
Maybe:
struct thing
{
char *s;
int i;
};
static char thing__t1[]= "foo";
static char thing__t2[]= "foo";
struct thing t1 = { thing__t1, 4 };
struct thing t2 = { thing__t2, 4 };
Éric Brunet
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Thu Mar 23 2000 - 21:00:34 EST