comp.lang.ada
 help / color / mirror / Atom feed
From: Samuel Mize <smize@imagin.net>
Subject: Re: Alternate to Unchecked_Conversion - Portable?
Date: 1999/02/23
Date: 1999-02-23T00:00:00+00:00	[thread overview]
Message-ID: <7av5h3$62g@news3.newsguy.com> (raw)
In-Reply-To: m3sobxfpwd.fsf@mheaney.ni.net

Matthew Heaney <matthew_heaney@acm.org> 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




  reply	other threads:[~1999-02-23  0:00 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-21  0:00 Alternate to Unchecked_Conversion - Portable? Steve Doiel
1999-02-21  0:00 ` Matthew Heaney
1999-02-21  0:00 ` Steve Quinlan
1999-02-22  0:00   ` robert_dewar
1999-02-22  0:00 ` Tom Moran
1999-02-22  0:00 ` robert_dewar
1999-02-22  0:00   ` Samuel Mize
1999-02-22  0:00 ` Christopher Green
1999-02-23  0:00   ` Matthew Heaney
1999-02-23  0:00     ` Samuel Mize [this message]
1999-02-24  0:00     ` robert_dewar
1999-02-25  0:00       ` Nick Roberts
1999-02-25  0:00         ` robert_dewar
1999-02-26  0:00           ` Nick Roberts
1999-02-26  0:00             ` Matthew Heaney
1999-02-27  0:00               ` Nick Roberts
1999-02-24  0:00   ` robert_dewar
1999-02-23  0:00     ` Christopher Green
1999-02-25  0:00       ` robert_dewar
1999-02-24  0:00         ` Christopher Green
1999-02-25  0:00           ` robert_dewar
1999-02-26  0:00             ` Dale Stanbrough
1999-02-26  0:00               ` Robert A Duff
1999-02-23  0:00     ` Christopher Green
1999-02-25  0:00       ` robert_dewar
1999-02-24  0:00         ` Christopher Green
1999-02-25  0:00           ` robert_dewar
1999-02-25  0:00             ` dennison
1999-02-25  0:00               ` Christopher Green
1999-02-26  0:00                 ` robert_dewar
1999-02-26  0:00                   ` Christopher Green
1999-03-01  0:00                     ` Nick Roberts
1999-03-01  0:00                       ` dewar
1999-03-01  0:00                         ` Nick Roberts
1999-02-26  0:00                 ` Tom Moran
1999-02-26  0:00                   ` robert_dewar
1999-02-26  0:00             ` Robert A Duff
1999-02-28  0:00               ` robert_dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox