This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: threadsafeness at egcs1.0.3 and 1.1


On 10 Jul 1998 20:24:11 -0700, you wrote:

>martin@mira.isdn.cs.tu-berlin.de (Martin von Loewis) writes:
>
>> int f()
>> {
>>   static int i = get_some_value();
>>   return i;
>> }
>> 
>> If two threads call f concurrently, initialization might be performed
>> twice. Since this can be handled on the application level in many
>> cases, it is not considered a serious problem (by some).
>
[...]
>I see this case as a real boundary case which probably shouldn't
>handled at all and the use of non-const initializing of static
>variables should be outlawed.

Have you read Meyer's comment in MEC++, about function static vs class
static? (pg 133-134)

His basic comment is that function statics have value in that they nail
down the point of initialisation a some function call time.  

Nicholas

--
        "I reserve the right to contradict myself" 
n.lee with math.auckland.ac in nz
NO commercial email please! No SPAM for me.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]