comp.lang.ada
 help / color / mirror / Atom feed
* Slicing & sliding
@ 1999-04-23  0:00 John B. Mattehws, M.D.
  1999-04-23  0:00 ` Tucker Taft
  0 siblings, 1 reply; 3+ messages in thread
From: John B. Mattehws, M.D. @ 1999-04-23  0:00 UTC (permalink / raw)



Given the following program

with Text_IO;

procedure Slice is

S : String (1 .. 64) := (others => '.');

    function F return String is
    begin
        return "result";
    end F;

begin

    Text_IO.Put_Line(S);
    S(S'Range) := F(S'Range);
    Text_IO.Put_Line(S);
    
end Slice;

The output is
................................................................
result

I was suprised to see that the indicated slice of F (F(S'Range)) is allowed
to be larger than the result returned by F, despite RM 4.1.2(7). For
smaller slices, the remainder of S seems to slide down, and the rest is
padded with nulls. Can someone help me understand this? Is this conformant
with the RM?

Thanks,

John
----
John B. Matthews, M.D.
matthewsj@saic.com; jmattthews@nova.wright.edu




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-04-25  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-04-23  0:00 Slicing & sliding John B. Mattehws, M.D.
1999-04-23  0:00 ` Tucker Taft
1999-04-25  0:00   ` John B. Matthews, M.D.

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