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,cef1e23795181e0c X-Google-Attributes: gid103376,public From: Samuel Mize Subject: Re: Alternate to Unchecked_Conversion - Portable? Date: 1999/02/23 Message-ID: <7av5h3$62g@news3.newsguy.com>#1/1 X-Deja-AN: 447641832 References: <36d05e39.0@news.pacifier.com> <36d2638e.6427631@nntp.concentric.net> Organization: ImagiNet Communications, Ltd. User-Agent: tin/pre-1.4-981002 ("Phobia") (UNIX) (AIX/3-2) Newsgroups: comp.lang.ada Date: 1999-02-23T00:00:00+00:00 List-Id: Matthew Heaney wrote: > A copy doesn't necessarily occur. If I use a constant declaration: > > procedure Op (O : T) is > > OO : constant TT := UC (O); > begin > > > then (I assume) there isn't any copy of the source object. This is an example of where the Ada programmer expects the compiler to do intelligent things. On the other hand, programmers accustomed to other languages see a function call, and by golly they expect there to be a function call! This is one source of the erroneous "common wisdom" that Ada is inherently slow. I've had people argue against creating new subtypes because they don't want to incur the run-time overhead of the type conversion: type New_Int is new Integer; Freem: Integer := Get_Value; New_Freem: New_Int; begin New_Freem := New_Int (Freem); -- Oh no! It looks like a function call, so it must have -- the same run-time overhead as a function call! Best, Sam Mize -- Samuel Mize -- smize@imagin.net (home email) -- Team Ada Fight Spam: see http://www.cauce.org/ \\\ Smert Spamonam