🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #137

static constructors and libraries

#137
From: Bradley D. Keister
Date: Fri, 31 Jul 1992 11:21
24 lines
1443 bytes
A library which I have developed makes occasional use of static
constructors (which generate constants use frequently in
applications).  I've just noticed that the SPARC version of g++
generates code which initializes those constants to zero, but
initializes correctly if the .o file is linked in directly.  If I do
the same thing with the DECstation version of g++, I get correct
initialization from the code in the library, and the same is true
using cfront on the DECstation.

The code which uses the numbers from the static initialization is not
itself in any constructor; in fact, it's in main().  I may be
misunderstanding the warnings about implementation dependence of
static constructors, but I'm surprised that two machine versions of
g++ (both 2.2.2) handle it differently.

Brad Keister
Department of Physics
Carnegie Mellon University
Pittsburgh, PA 15213
(412) 268-2772 (office)
(412) 681-0648 (FAX)

internet:	keister@poincare.phys.cmu.edu
BITNET:		keister%poincare.phys.cmu.edu@CARNEGIE
Technical Details
Message-ID: <9207311921.AA18595@poincare.phys.cmu.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!poincare.phys.cmu.edu!keister

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!poincare.phys.cmu.edu!keister
From: keister@poincare.phys.cmu.edu (Bradley D. Keister)
Subject: static constructors and libraries
Message-ID: <9207311921.AA18595@poincare.phys.cmu.edu>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Fri, 31 Jul 1992 11:21:37 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 25