comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam@spam.com>
Subject: Re: Aliasing or referencing assignment
Date: Sun, 11 Sep 2005 03:20:50 GMT
Date: 2005-09-11T03:20:50+00:00	[thread overview]
Message-ID: <moNUe.8740$Wd7.8338@newsread1.news.pas.earthlink.net> (raw)
In-Reply-To: <m3irx9yzxo.fsf@rr.trudgett>

David Trudgett wrote:
> Without knowing the details of how they work, I was just assuming they
> would be pre-elaborated during the compilation process.

GNAT in gcc 3.4.2 implements Unbounded_String as

    package AF renames Ada.Finalization;

    Null_String : aliased String := "";

    type Unbounded_String is new AF.Controlled with record
       Reference : String_Access := Null_String'Access;
       Last      : Natural       := 0;
    end record;

and To_Unbounded_String as

    function To_Unbounded_String (Source : String) return Unbounded_String is
       Result : Unbounded_String;

    begin
       Result.Last          := Source'Length;
       Result.Reference     := new String (1 .. Source'Length);
       Result.Reference.all := Source;
       return Result;
    end To_Unbounded_String;

Other implementations are possible.

-- 
Jeff Carter
"I'm a lumberjack and I'm OK."
Monty Python's Flying Circus
54



      parent reply	other threads:[~2005-09-11  3:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-09  0:20 Aliasing or referencing assignment David Trudgett
2005-09-09  2:13 ` Steve
2005-09-09  7:33   ` David Trudgett
2005-09-09 15:40 ` Jeffrey Carter
2005-09-10  7:38   ` David Trudgett
2005-09-10 10:01     ` Martin Dowie
2005-09-10 10:33       ` David Trudgett
2005-09-10 11:28         ` Ludovic Brenta
2005-09-11 20:43           ` David Trudgett
2005-09-11  3:20         ` Jeffrey R. Carter [this message]
replies disabled

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