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,45a9122ddf5fcf5 X-Google-Attributes: gid103376,public From: mheaney@ni.net (Matthew Heaney) Subject: Re: Rules for Representation of Subtypes Date: 1996/09/29 Message-ID: #1/1 X-Deja-AN: 186064248 references: content-type: text/plain; charset=ISO-8859-1 organization: Estormza Software mime-version: 1.0 newsgroups: comp.lang.ada Date: 1996-09-29T00:00:00+00:00 List-Id: In article , bobduff@world.std.com (Robert A Duff) wrote: >Anyway, are you saying that GNAT fails to optimize cases like this: > > X: Integer range 1..10 := 1; > ... > if X < 10 then -- must be true > >But what if the "..." contains an unchecked conversion that sets X to >11? That's easy: program execution is erroneous. Very likely the compiler *will* make that optimization. s If one leaves the language (via unchecked_conversion) and violates the type constraints, then he the programmer is at fault. Who can say what the compiler does, because program behaviour is in fact undefined. >- Bob Matt -------------------------------------------------------------------- Matthew Heaney Software Development Consultant mheaney@ni.net (818) 985-1271