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-11 17:10:44 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.uchicago.edu!vixen.cso.uiuc.edu!uwm.edu!rpi!not-for-mail From: "Andrei Alexandrescu" Newsgroups: comp.lang.ada,comp.lang.c++.moderated Subject: Re: C bug of the day Date: 11 Jun 2003 20:12:57 -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: Wed, 11 Jun 2003 13:39:20 -0700 X-Submission-Address: c++-submit@netlab.cs.rpi.edu X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated iQBVAwUAPufFfUHMCo9UcraBAQG+PAH/T6nTDqu2+5OenEgeC7hwnrlif0OmUu9N BxhhDFoLt39EwXuqXhc34ZCdrbZug9jZwxWKASir5gto4T7vk2/O9A== =XM16 Xref: archiver1.google.com comp.lang.ada:39016 comp.lang.c++.moderated:68181 Date: 2003-06-11T20:12:57-04:00 List-Id: "James Rogers" wrote in message news:Xns9396BDBB14558jimmaureenrogers@204.127.36.1... > Its defaults are fundamentally safe. It provides the ability to > override the safety constraints whenever you choose to. Note how > Ada differs from Java. You cannot turn off array bounds checking > for Java. In Ada you can. In fact, many Ada compilers will optimize > out bounds checking when they can determine the checks are > unnecessary. In fairness, it should be said that Java optimizers have the same prerogative. > In other words, you can arrive at the same level of safety which > is the default for C++. With Ada, however, you need to remove > safety checks to get there. Manually removing safety checks is not > usually needed for performance reasons. > > Most programmers will use a language in the manner which requires > minimum effort. This is why safety checks are not terribly common > in C++. It is also why manually turning off safety checks is not > terribly common in Ada. That's deep. I bet a ton of problems would have not existed through the years if C (or at least C++) would have required: int i = uninitialized; instead of: int i; to define an uninitialized variable, and would have defaulted to zero-initialization in the latter case. Andrei [ Send an empty e-mail to c++-help@netlab.cs.rpi.edu for info ] [ about comp.lang.c++.moderated. First time posters: do this! ]