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,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2e71cf22768a124d X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Assertions (was: Re: next "big" language?? (disagree)) Date: 1996/06/25 Message-ID: #1/1 X-Deja-AN: 162061264 references: <4ql1fv$5ss@goanna.cs.rmit.EDU.AU> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-06-25T00:00:00+00:00 List-Id: In article , Robert Dewar wrote: >Bob Duff said > >" > pragma Suppress(Assertion_Check); > pragma Assert(...); >" >Not quite, remember that failing an assertion raises Assert_Error, it is >not erroneous, so the compiler cannot assume (not P) at the point where >the assert appears, it can only assume (not P) after the asssertion >which is a VERY much weaker condition. What's "not P"? Are you assuming the above is "pragma Assert(not P);"? According to 11.5(26), failing a check IS erroneous, if that check has been suppressed. According to 11.5(27), an implementation may "add additional check names, with implementation-defined semantics" -- such as the Assertion_Check that I invented, above. Since failing the suppressed check would be erroneous, this can affect the generated code both before and after the assertion, depending on how smart your optimizer is. I'm not sure what you mean by "at the point where the assert appears" -- it's been suppressed, and will therefore presumably not generate any code. Of course, if the assertion is not suppressed, then the compiler can only know that the condition is true following the check. Perhaps I'm misunderstanding what you said, but it seems to me that in this regard (what the compiler can and cannot assume, with and without pragma Suppress) the pragma Assert is just like a normal constraint check (except, of course, that Asserts can have side-effects :-( ). Of course, pragma Assert is implementation defined, so it can have whatever semantics the implementer wants. - Bob