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: fc772,b30bd69fa8f63cb2 X-Google-Attributes: gidfc772,public X-Google-Thread: 103376,b30bd69fa8f63cb2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-14 13:25:20 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!xmission!news-out.spamkiller.net!propagator2-maxim!news-in-maxim.spamkiller.net!usc.edu!rpi!not-for-mail From: =?Windows-1252?Q?Terje_Sletteb=F8?= Newsgroups: comp.lang.ada,comp.lang.c++.moderated Subject: Re: C bug of the day Date: 14 Jun 2003 16:27:33 -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: Sat, 14 Jun 2003 13:41:32 +0200 X-Submission-Address: c++-submit@netlab.cs.rpi.edu X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated iQBVAwUAPuuFMUHMCo9UcraBAQFzCAH/e0EUXhgOziVtJB4+9MDUA6QYsCeV/LdR R2Uszr5e1BcgAxUFaOyECHsgc5UqNkPkRu7i3f2jrtXvncBQa1lRTA== =a3Xy Xref: archiver1.google.com comp.lang.ada:39183 comp.lang.c++.moderated:68358 Date: 2003-06-14T16:27:33-04:00 List-Id: "Ron Natalie" wrote in message news:Fn2dnUzrDqr3YXSjXTWQlg@giganews.com... > > "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). "auto" has already been suggested reused for the type inference proposal. :) ("Decltype and auto" (http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1478.pdf)). However, that may not clash in this case. Anyway, this may be a QoI issue. A compiler could warn if an uninitialised variable is read from, and they typically do. Regards, Terje [ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ] [ about comp.lang.c++.moderated. First time posters: do this! ]