🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #2458

Re: ??? static locals in inline functions ???

#2458
From: Dick Menninger
Date: Tue, 07 Nov 1995 20:34
39 lines
2067 bytes

> ==========Kaelin Colclasure, 11/5/95==========
> 
> 
> Thanks for the clarification!  I wonder, though, if this isn't
> something of a gratuitious inconsistancy.  For all other function
> definitions, extern is the default-- you have to use the static
> keyword to restrict the definition to file scope.  Now the draft is
> saying that inline functions get exactly the *opposite* semantics
> (ie. static is assumed, extern must be declared explicitly).
> 
> The only reason I can fathom for this is for compatibility with
> existing, pre-standard C++ code-- and I'd say that's a pretty weak
> basis given my intuition that this usage in existing implementations
> should be pretty rare.  Am I just missing something?
> -- 
> // Kaelin Colclasure

A better way to look at this is to see that inline behaves
like const as they both default to internal scope.
I suspect this choice comes from applicability to
member functions.  If you made inline default to
external scope, you would have difficulty changing
that to internal scope for member functions.  Attaching
static would have a rather different semantics.
However, having inline default to internal scope
allows extern to be applied without a change of
class-level semantics of the function.

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: <DHou9J.L8t@falcon.daytonoh.attgis.com>
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
References: <KAELIN.95Nov4090501@binki.bridge.com>

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: 07 Nov 1995 20:34:56 GMT
Organization: AT&T Global Information Solutions
Approved: matt@physics2.Berkeley.EDU (Matt Austern)
Message-ID: <DHou9J.L8t@falcon.daytonoh.attgis.com>
References: <KAELIN.95Nov4090501@binki.bridge.com>
Reply-To: mennid <Dick.Menninger@DaytonOH.ATTGIS.COM>
NNTP-Posting-Host: physics2.berkeley.edu