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 (Trevor Yann)
- Subject: Re: [PATCH] problem with static variables in template functions
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 12 Aug 1998 20:43:33 -0300
- Cc: egcs-patches at cygnus dot com
- References: <35D0CEB1.55408AFC@vet.com.au>
Trevor Yann <TYann@vet.com.au> writes:
> I'm not sure that this patch is correct. The default linkage for an
> inline function is internal, rather than external.
In C++, the `inline' keyword does not cause a function to have
internal linkage.
> 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.
In C++, an inline function must have the same address in all
translation units, and its local static variables must be unified
across translation units [dcl.fct.spec]/4
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil