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-14 02:55:15 PST From: "Ron Natalie" Newsgroups: comp.lang.ada,comp.lang.c++.moderated Subject: Re: C bug of the day Date: 14 Jun 2003 05:57:26 -0400 Organization: unknown Sender: cppmods@netlab.cs.rpi.edu Message-ID: References: <1054751321.434656@master.nyc.kbcfp.com> NNTP-Posting-Host: netlab.cs.rpi.edu X-Original-Date: Fri, 13 Jun 2003 12:31:38 -0400 X-Submission-Address: c++-submit@netlab.cs.rpi.edu X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated iQBVAwUAPurxgkHMCo9UcraBAQGoAQH/SwU1tZtoFGZ3JTJTNy+6zeFUfQvLD5Mj LwwsJn2X2gW+wJjqfNV1zQ2QJPT8lmjnNX+70t0OgNTJ1LHsLgOE5g== =Uelx Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!out.nntp.be!propagator2-sterling!news-in-sterling.newsfeed.com!news.destek.net!news-out.newsfeeds.com!propagator2-maxim!news-in-maxim.spamkiller.net!usc.edu!rpi!not-for-mail Xref: archiver1.google.com comp.lang.ada:39163 comp.lang.c++.moderated:68334 Date: 2003-06-14T05:57:26-04:00 List-Id: "Terje Sletteb" wrote in message news:WXiGa.11515$KF1.273500@amstwist00... > > > I am sorry. I misunderstood. I thought you were being sarcastic. > > If your suggestion was adopted, how would it affect existing > > programs? For that matter, why would you ever *want* uninitialized > > variables? > > Reading from streams is an obvious example: > > int i; > > stream >> i; > > Intialising "i" beforehand would just be vasteful. It wouldn't break anything, just make it a tiny bit slower. If you allowed something to inidicate uninitialized, you could get the performance back. int i; // initialize to 0 stream >> i; auto int i; // recycle auto to mean uninitialized. stream >> i; In the above case existing code that used the unqualified name would work in old and new compilers (with a slight performance hit in the new complier), those in the second case would work the same way in the old and new compiler (the same way it used to). The failure to initialize all variables is one of the major inconsistancies of C++, along with the braindamaged way arrays work. [ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ] [ about comp.lang.c++.moderated. First time posters: do this! ]