Re: constant variables are not always placed in shared memory



> static const char * const my_strings[] = {
>   "hello", "world", "foo"
> }

I think there are two reasons for my_strings not to be shared.

First, my_strings was *not* declared const (the strings it points to
are, but not my_strings itself.  I think it would have to be declared

	const char *const my_strings[] = {...}

for my_strings to be const.


But even so, I still don't think it could be shared between processes
due to relocation.  Each process would see the strings at a different
address and would require a private copy of my_strings to point to
that address.

	-ed falk



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]