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-18 14:12:49 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!uwm.edu!rpi!not-for-mail From: "Balog Pal" Newsgroups: comp.lang.ada,comp.lang.c++.moderated Subject: Re: C bug of the day Date: 18 Jun 2003 17:15:05 -0400 Organization: LiB Sender: cppmods@netlab.cs.rpi.edu Message-ID: <3ef04f80@andromeda.datanet.hu> References: <1054751321.434656@master.nyc.kbcfp.com> NNTP-Posting-Host: netlab.cs.rpi.edu X-Original-Date: Wed, 18 Jun 2003 12:57:12 +0100 X-Submission-Address: c++-submit@netlab.cs.rpi.edu X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated iQBVAwUAPvDWVUHMCo9UcraBAQFWCQIApP900jyQiEkkQ/f3gx4yMlVF1xfa0CeZ P73MiKlZZOC28Nbs8hrMhsEwRNPLFGn7hEwYdoLuqQDjY6Arp8lvTg== =Nt2p Xref: archiver1.google.com comp.lang.ada:39412 comp.lang.c++.moderated:68650 Date: 2003-06-18T17:15:05-04:00 List-Id: "James Rogers" wrote in message news:Xns9398BD1E07E3Ejimmaureenrogers@204.127.36.1... > 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? Another way to ask that is when is initialization a bad > thing? In a C-like langage it's good to have option to not initialise something (right where it's created). When you write stuff that is time-sensitive unneeded memory access is bad. The problem is not with existance of that feature but its being the default. A dengerous and rarely needed feature should be an 'I explicitly ask for' thing. Example to noinit is a case where you need a variable only on certain path of execution. On that path it is inited and used, the others do not touch it. There are cases you don't put the whole path in a single if. Another example is when you grab a local buffer char[64k]. And wrute some small amount of data into it. Or immediately load it with data from somewhere. Default initing the whole is just a waste of time. Paul [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]