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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Static variables in template functions


On Sun, 17 Apr 2005 19:38:36 -0700, Mark Mitchell <mark@codesourcery.com> wrote:

> Jason Merrill wrote:
>
>>>From your recommendation, you think it better to generate faster code on
>>>these systems (by avoiding the dynamic initialization), even though that
>>>means that the code is sometimes incorrect (in that the variables are
>>>duplicated, and a conforming program can detect the difference).
>> Detect how?  If it's const, you can't modify it, so if you don't take its
>> address I don't think it's possible for a conforming program to tell
>> whether or not there's a single copy.
>
> Sorry; I was referring only to the non-const and/or addressed case.  In
> those cases, the generated code will be incorrect; it could be made correct
> by using a dynamic initialization.

I was only suggesting that we don't warn for const, non-addressed
variables, which I believe was the case in question here.  For others I
would leave the warning.

Jason


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