threadsafeness at egcs1.0.3 and 1.1

Nicholas Lee n.lee@math.auckland.ac.nz
Mon Jul 13 04:36:00 GMT 1998


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.



More information about the Gcc mailing list