comp.lang.ada
 help / color / mirror / Atom feed
From: "Matthew Heaney" <matthew_heaney@acm.org>
Subject: 11.6
Date: 1999/11/20
Date: 1999-11-20T00:00:00+00:00	[thread overview]
Message-ID: <3836ff5b_1@news1.prserv.net> (raw)

Suppose we have a bounded stack:

  type Stack_Type (Size : Positive) is limited private;

  procedure Push
    (Stack : in out Stack_Type;
     Item  : in Item_Type);

private

  type Stack_Type (Size : Positive) is
    limited record
      Top : Natural := 0;
      Items : Item_Array (1 .. Size);
    end record;

end Stacks;


Now consider an implementation of Push:

  procedure Push
    (Stack : in out Stack_Type;
     Item  : in     Item_Type) is

     subtype Top_Range is Positive range 1 .. Stack.Size;

     Top : Natural renames Stack.Top;
  begin
     Top := Top_Range'(Top + 1);    --???
     Stack.Items (Top) := Item;
  end Push;


Is it possible, because of 11.6 permissions, that the explicit range
check in the marked line can be optimized away?

Another question: if I compile this (or the instantiation?) with checks
off, then will that cause the explicit range check to be omitted?




             reply	other threads:[~1999-11-20  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-20  0:00 Matthew Heaney [this message]
1999-11-22  0:00 ` 11.6 Mats Weber
1999-11-22  0:00   ` 11.6 Robert Dewar
1999-11-22  0:00 ` 11.6 Robert A Duff
1999-11-22  0:00   ` 11.6 Matthew Heaney
1999-11-23  0:00     ` 11.6 Robert A Duff
replies disabled

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