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,f71c159449d6e114 X-Google-Attributes: gid103376,public From: Eric Miller Subject: Re: Ada 83 - avoiding unchecked conversions. Date: 1996/12/17 Message-ID: <32B6905F.FC4@tiac.net>#1/1 X-Deja-AN: 204538088 references: <32AED68A.48BE@aisf.com> <32b03008.564464@netnews.worldnet.att.net> <58np72$9qp@news.nyu.edu> content-type: text/plain; charset=us-ascii organization: The Internet Access Company, Inc. mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 3.0 (Win16; I) Date: 1996-12-17T00:00:00+00:00 List-Id: Richard Kenner wrote: > > In article <32b03008.564464@netnews.worldnet.att.net> dewi@cableol.co.uk (Dewi Daniels) writes: > >Ada 83 prohibits the use of address clauses to alias two variables > >(LRM 13.5). I believe it's legal in Ada 95. My preference would be to > >use an unchecked conversion. > > An unchecked conversion is much more efficient. Using an address > clause not only forces the object into memory, but disables many > optimizations on it (essentially treats it as volatile). I'm fairly certain that we're heading into compiler-specific territory now. Efficiency issues are tough to generalize. I used to work at the same company as a guy who was having problems with a program that ran (essentially in batch) for several hours. One of his optimizations was to switch all the unchecked conversions to conversions using overlays. Apparently on that compiler (VAX Ada 1.something) unchecked conversion was doing some checks. My recommendation is to use unchecked conversion because you're doing just what your code says you're doing. Overlays just give the reader one more thing to think about. Eric