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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,25aa3c7e1b59f7b5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-01-05 07:00:01 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.direct.ca!look.ca!wn1feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc53.POSTED!not-for-mail From: "Steve Doiel" Newsgroups: comp.lang.ada References: <3C34BF2C.6030500@mail.com> Subject: Re: A case where Ada defaults to unsafe? X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: NNTP-Posting-Host: 12.225.227.101 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc53 1010242800 12.225.227.101 (Sat, 05 Jan 2002 15:00:00 GMT) NNTP-Posting-Date: Sat, 05 Jan 2002 15:00:00 GMT Organization: AT&T Broadband Date: Sat, 05 Jan 2002 15:00:00 GMT Xref: archiver1.google.com comp.lang.ada:18580 Date: 2002-01-05T15:00:00+00:00 List-Id: My 2 cents. I disagree with your initial statement. In my view Ada has no "default" behaviour. You have been describing 4 distinct operations: "and" "or" "and then" "or else" Each of these operators perform distinct and well defined functions. The American Heritage dictory describes the word "and" as: Together with or along with; also; in addition; as well as. I belive the definition of the "and" operator fits this description more closely than "and then". When I learned simple boolean logic I was taught that "a and b" is true if and only if both "a" and "b" are both true. Sure you can get smart and figure out how to short circuit things but the most obious behavior does not. In my opinion the behavior of "and" and "or" are what you would expect, unless you're coming from the 'C' world, where you've been forced to pound a plethora of implicit rules into your head. By the way I think that's one of the main reasons Ada is safer, rules in Ada are (usually) explicit rather than implicit (although I still gripe about the scope of a tagged type being implicit). SteveD "Hyman Rosen" wrote in message news:3C34BF2C.6030500@mail.com... > The conventional belief (at least on CLA :-) is that one of the > main distinctions between Ada and C/C++ is that Ada defaults to > safe behavior and C/C++ defaults to unsafe behavior (eg., array > indexing, automatic type conversions, and overflow checking). > > It occurs to me that there is a case where the opposite seems to > be true. In C/C++, the && and || binary operators short-circuit, > evaluating their right operand only if necessary. In Ada, it is > necessary to specify "and then" and "or else" for this behavior, > otherwise the order of evaluation of the two sides is unspecified > if the simple "and" and "or" forms are used. > > So in Ada, one could say 'if a /= 0 and b/a > 3' and fall into a > trap that would not happen in C/C++. Discuss? >