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:48:33 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!uwm.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: 14 Jun 2003 05:50:45 -0400 Organization: http://groups.google.com/ 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: 13 Jun 2003 08:32:48 -0700 X-Submission-Address: c++-submit@netlab.cs.rpi.edu X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated iQBVAwUAPurv8UHMCo9UcraBAQHveAIAluJc06vk8OgbXysr7SJu4aLwU7J77ipf sULxUnkYjtgaOml0sL2vKM8xT3Mbr9THOS5LPRh7hh7YMbBHNAl3bQ== =HEVq Xref: archiver1.google.com comp.lang.ada:39158 comp.lang.c++.moderated:68325 Date: 2003-06-14T05:50:45-04:00 List-Id: James Rogers wrote in message news:... > "Andrei Alexandrescu" wrote > in news:bc9h7j$gm42t$1@ID-14036.news.dfncis.de: > > I was mentioning that just to mention a simple language design > > decision that's a no-brainer to implement, yet which imho has a > > great impact because of the psychological issue you mentioned. The > > others are also important, but not as trivial to implement and > > support without making performance tradeoffs. > 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? For the same reason you might want to access an array without a bounds check, I guess: performance. If you know that the initialization will take place before the variable is used, and you have a performance problem, initialization is a loss of time. I imagine that such cases would be rare. But then, I imagine that they would be exceedingly rare for bounds checking, too. FWIW: I've seen numeric benchmarks where Java (with bounds checking) runs faster than C++ (without). The reason is simple: the Java compiler is able to hoist the bounds checking out of the tight loops, or even eliminate it entirely. And it doesn't have to deal with all of the aliasing issues due to the language supporting pointer arithmetic. It's probably worth pointing out that C's pointer arithmetic is not only dangerous, and a significant source of errors, but it also makes programs run slower. -- James Kanze GABI Software mailto:kanze@gabi-soft.fr Conseils en informatique oriente objet/ Beratung in objektorientierter Datenverarbeitung 11 rue de Rambouillet, 78460 Chevreuse, France, Tl. : +33 (0)1 30 23 45 16 [ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ] [ about comp.lang.c++.moderated. First time posters: do this! ]