Article View: comp.std.c++
Article #2508Re: ??? static locals in inline functions ???
From: Dick Menninger
Date: Fri, 10 Nov 1995 19:55
Date: Fri, 10 Nov 1995 19:55
61 lines
3021 bytes
3021 bytes
> ==========Fergus Henderson, 11/8/95========== > > > kaelin@bridge.com (Kaelin Colclasure) writes: > > >Dick Menninger <Dick.Menninger@DaytonOH.ATTGIS.COM> writes: > > > > Dick> A better way to look at this is to see that inline > > Dick> behaves like const as they both default to internal scope. > > Dick> I suspect this choice comes from applicability to member > > Dick> functions. If you made inline default to external scope, > > Dick> you would have difficulty changing that to internal scope > > Dick> for member functions. Attaching static would have a rather > > Dick> different semantics. However, having inline default to > > Dick> internal scope allows extern to be applied without a change > > Dick> of class-level semantics of the function. > > There has been some confusion of the three distinct concepts of scope > (visibility), access, and linkage in this thread. Everywhere that Dick > Menninger refers to "scope", he should be referring to "linkage". > > > The concept of a member function with "extern" scope would be > meaningless, > but the concept of a member function having external linkage is quite > meaningful. Indeed, all member functions have external linkage, except > for member functions of local classes defined withing other functions, > which have no linkage. > I should have done more "homework" and been more careful on wording before replying. I was too focused on getting posts to work instead of what I was saying. If a class has external linkage, its member names have external linkage (3.5.5 dominates). This means that a static local in an inline member function behaves differently than the default for a regular inline function (which still has internal linkage by default). Further, there is no way to get the behavior of inline member functions to match the default behavior for regular inline functions. This is no great loss, except in the area of understandability of the language. So much for naively plugging ideas together and thinking you did something valid. At least I got the inline "is like" const part right. (as he flakes a little more rust off in a maximally public way) Good Day Dick Dick.Menninger@DaytonOH.ATTGIS.COM --- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu. Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID:
<DHuE7r.K15@falcon.daytonoh.attgis.com>Path:
arc1-ca.pugleaf.net!128.32.155.1!mattReferences:
<9531214.21952@mulga.cs.mu.OZ.AU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt From: Dick Menninger <Dick.Menninger@daytonoh.attgis.com> Newsgroups: comp.std.c++ Subject: Re: ??? static locals in inline functions ??? Date: 10 Nov 1995 19:55:37 GMT Organization: AT&T Global Information Solutions Approved: matt@physics2.Berkeley.EDU (Matt Austern) Message-ID: <DHuE7r.K15@falcon.daytonoh.attgis.com> References: <9531214.21952@mulga.cs.mu.OZ.AU> Reply-To: mennid <Dick.Menninger@daytonoh.attgis.com> NNTP-Posting-Host: physics2.berkeley.edu