comp.lang.ada
 help / color / mirror / Atom feed
* 11.6
@ 1999-11-20  0:00 Matthew Heaney
  1999-11-22  0:00 ` 11.6 Mats Weber
  1999-11-22  0:00 ` 11.6 Robert A Duff
  0 siblings, 2 replies; 6+ messages in thread
From: Matthew Heaney @ 1999-11-20  0:00 UTC (permalink / 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?




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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-20  0:00 11.6 Matthew Heaney
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

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