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=-0.5 required=5.0 tests=BAYES_00,HEADER_SPAM, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: fc772,b30bd69fa8f63cb2 X-Google-Attributes: gidfc772,public X-Google-Thread: 103376,b30bd69fa8f63cb2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-16 15:49:53 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.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: kanze@gabi-soft.fr Newsgroups: comp.lang.ada,comp.lang.c++.moderated Subject: Re: C bug of the day Date: 16 Jun 2003 18:52:05 -0400 Organization: http://groups.google.com/ Sender: cppmods@netlab.cs.rpi.edu Message-ID: References: NNTP-Posting-Host: netlab.cs.rpi.edu X-Original-Date: 16 Jun 2003 02:58:18 -0700 X-Submission-Address: c++-submit@netlab.cs.rpi.edu X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated iQBVAwUAPu5KDUHMCo9UcraBAQFsMAH9GRRuaCanezMqkruwtL69fS5L81OEoPCW 3jOpHaYDhOdB2Nz6aC5dmXUDpMJ9Re5Z5feGKVgPSW7NUpPsFFP34Q== =CkWp Xref: archiver1.google.com comp.lang.ada:39295 comp.lang.c++.moderated:68475 Date: 2003-06-16T18:52:05-04:00 List-Id: brangdon@cix.co.uk (Dave Harris) wrote in message news:... > jimmaureenrogers@att.net (James Rogers) wrote (abridged): > > If your suggestion was adopted, how would it affect existing > > programs? > Some currently non-portable ones would become well-behaved. > > 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. On the other hand, I could imagine unitialised as a special type (an enum), which told std::vector NOT to call the copy constructor on each element. In which case, what happens if I write: std::vector< std::string > vec( 1000000, uninitialized ) ; ? -- James Kanze GABI Software mailto:kanze@gabi-soft.fr Conseils en informatique orient�e objet/ Beratung in objektorientierter Datenverarbeitung 11 rue de Rambouillet, 78460 Chevreuse, France, T�l. : +33 (0)1 30 23 45 16 [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]