home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!know!mips2!news.bbn.com!noc.near.net!hri.com!spool.mu.edu!news.cs.indiana.edu!umn.edu!csus.edu!netcom.com!knee
- From: knee@netcom.com (Mark Lanett)
- Newsgroups: comp.lang.c++
- Subject: Re: MPW C++ bug?
- Message-ID: <1992Nov12.224642.839@netcom.com>
- Date: 12 Nov 92 22:46:42 GMT
- References: <BxKz81.8C5@vcd.hp.com>
- Organization: Netcom - Online Communication Services (408 241-9760 guest)
- Lines: 19
-
- John Matthews <jm@vcd.hp.com> writes:
-
- >I seem to have run into a possible bug between the C++ compiler and the
- >MPW linker.
- >The problem concerns statically (globally) allocated objects with
- >constructors.
- >If the global object is not referenced anywhere else in the program, but
- >does have
- >a constructor that causes side-effects, I believe the semantics of C++
- >states that
- >that object must be constructed.
-
- >However, since the linker notices that no-one is actually using the
- >global variable,
- >it strips out the object, along with its constructor call, from the
- >program.
-
- Apple introduced that bug *on purpose*, to help the linker do dead stripping.
- The -z5 option stops it. I know it's mentioned in the release notes, BTW.
-