This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] problem with static variables in template functions
- To: TYann at vet dot com dot au, egcs-patches at cygnus dot com
- Subject: Re: [PATCH] problem with static variables in template functions
- From: scott snyder <snyder at d0sgif dot fnal dot gov>
- Date: 12 Aug 1998 23:54:56 -0500
- References: <35D0CEB1.55408AFC@vet.com.au>
>>The egcs 1.1 test version appears to mishandle static variables
>>in template functions on Digital Unix.
>I'm not sure that this patch is correct. The default linkage for an
>inline function is internal, rather than external.
>
>Inline functions with internal linkage are allowed (required?) to have a
>different instance of any local static variables for each translation
>unit that uses the function.
Hmm... After studying the spec a bit more, i think this is probably
correct. I therefore withdraw my patch.
(It still strikes me as somewhat surprising behavior, as i generally
wouldn't expect changing whether a function is inline or not to change
the behavior of a program, unless you're doing something like comparing
function pointers. And it's a little annoying that of the four or so
compilers i tested when trying to decide whether to rely on this,
all of them apparently got it wrong.)
thanks,
sss