From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,30f8e9ec3e840189 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-09-14 09:47:25 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sunqbc.risq.qc.ca!news.uunet.ca!nnrp1.tor.metronet.ca!not-for-mail Message-ID: <3BA2349B.4010807@home.com> From: "Warren W. Gay VE3WWG" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.2) Gecko/20010726 Netscape6/6.1 X-Accept-Language: en-us MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: avl tree - booch components References: <20010907091153.12625104.tonygair@nospam.blueyonder.co.uk> <3B9F7455.80605@home.com> <9nqdh0$938$1@a1-hrz.uni-duisburg.de> <3BA12F31.D75C1280@boeing.com> <3BA20845.3000907@home.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 14 Sep 2001 16:47:24 GMT NNTP-Posting-Host: 198.96.47.195 NNTP-Posting-Date: Fri, 14 Sep 2001 10:47:24 MDT Organization: MetroNet Communications Group Inc. Xref: archiver1.google.com comp.lang.ada:13081 Date: 2001-09-14T16:47:24+00:00 List-Id: Simon Wright wrote: > "Warren W. Gay VE3WWG" writes: >>Jeffrey Carter wrote: >> >>>Unless the constant is never referenced, and your compiler optimizes it >>>away. >>> >>That has never been my experience under GNAT, and never my >>experience under C/C++. > > With foo.cc containing > > static const char rcsid[] = "hello world"; > int main() > { > return 0; > } > > I get > > orm[410]$ c++ -v > Reading specs from /usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/specs > gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) > orm[411]$ c++ -O2 foo.cc > orm[412]$ strings a.out | grep hello > orm[413]$ c++ foo.cc > orm[414]$ strings a.out | grep hello > hello world > > (but gcc retains the string even with -O2) Ouch! You're right. This doesn't happen under HPUX with their C++ compiler, but obviously gcc is behaving differently. -- Warren W. Gay VE3WWG http://members.home.net/ve3wwg