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.3 required=5.0 tests=BAYES_00,HEADER_SPAM autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b30bd69fa8f63cb2 X-Google-Attributes: gid103376,public X-Google-Thread: fc772,b30bd69fa8f63cb2 X-Google-Attributes: gidfc772,public X-Google-ArrivalTime: 2003-06-17 03:44:17 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.news.rcn.net!rcn!elnk-nf1-atl!newsfeed.earthlink.net!in.100proofnews.com!in.100proofnews.com!news.moat.net!news-out.newsfeeds.com!propagator2-maxim!news-in-maxim.spamkiller.net!usc.edu!rpi!not-for-mail From: Kilgallen@SpamCop.net (Larry Kilgallen) Newsgroups: comp.lang.ada,comp.lang.c++.moderated Subject: Re: C bug of the day Date: 17 Jun 2003 06:46:27 -0400 Organization: LJK Software Sender: cppmods@netlab.cs.rpi.edu Message-ID: <6oS1t9htDqrI@eisner.encompasserve.org> References: NNTP-Posting-Host: netlab.cs.rpi.edu X-Original-Date: 16 Jun 2003 19:47:20 -0500 X-Submission-Address: c++-submit@netlab.cs.rpi.edu X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated iQBVAwUAPu7xgEHMCo9UcraBAQGdWAIAjA+4KDf1jA7dpmvURXGkMat5eor1MlHo t+fYvVQGUkbNO0hGryY7MVCl1+tR8HcWESpl09TCJiM8dxEcppFrdQ== =TVfq Xref: archiver1.google.com comp.lang.ada:39321 comp.lang.c++.moderated:68520 Date: 2003-06-17T06:46:27-04:00 List-Id: In article , kanze@gabi-soft.fr writes: > brangdon@cix.co.uk (Dave Harris) wrote in message > news:... >> jimmaureenrogers@att.net (James Rogers) wrote (abridged): >> > why would you ever *want* uninitialized variables? > >> Mainly for speed. We would want to be able to say, eg, >> std::vector vec( 1000000, unitialised ); > >> to avoid writing a million zeros. Which I suspect makes it a >> non-trivial language change. What is the type of "initialised"? > > Hmmm. Either you write a million zeros, or you write a million words > with junk. Either way, the actual execution time will not change on > typical machines. Certainly an operating system can map arbitrary existing memory pages into a particular chunk of virtual address space. The only reason to expect them to be zeroed or not based on operating system interests would be confidentiality of the data formerly on those pages of memory. VMS has "demand zero" pages that provide zeroed pages only on the first access to the page. I don't know if typical compilers are smart enough to use that feature on arrays explicitly initialized to zero. [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]