From: Jay Sachs <sachs@cs.williams.edu>
Subject: private type discriminants ignored?
Date: 1998/04/24
Date: 1998-04-24T00:00:00+00:00 [thread overview]
Message-ID: <rz84szje1ol.fsf@cs.williams.edu> (raw)
In a series of successive refinements of a stack package, I've
declared:
package Stacks4 is
type Stack(Size : Integer := 100) is private;
-- this version:
-- type Stack is private;
-- also exhibits the same behavior
procedure Push(S : in out Stack; X : Integer);
procedure Pop(S : in out Stack; X : out Integer);
function Empty(S : in Stack) return Boolean;
Stack_Overflow : exception;
Stack_Underflow : exception;
private
type stackrep is array(Integer range <>) of Integer;
type Stack(Size : Integer := 100) is record
Top : Natural := 0;
Rep : stackrep(1..Size);
end record;
end Stacks4;
I get warnings (from gnat 3.10) saying that I may get a storage_error
by creating a variable of type stack. I do in fact get such an error
if I declare
s : Stacks4.Stack;
and use it like:
Stacks4.push(s,3);
However, supplying the initialization as in
s2 : Stacks4.Stack(75);
allows
Stacks4.push(s2,3);
with no error. What is the reason that the default initialization
seems to be ignored in the discriminant for the private type?
-Jay
next reply other threads:[~1998-04-24 0:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Es7569.4n2@world.std.com>
1998-04-24 0:00 ` Jay Sachs [this message]
1998-04-24 0:00 ` private type discriminants ignored? Joel VanLaven
[not found] ` <Es3A4J.Ion@world.std.com>
1998-04-28 0:00 ` Samuel T. Harris
1998-04-28 0:00 ` Patrick D. Rogers
1998-04-28 0:00 ` Samuel T. Harris
1998-04-30 0:00 ` Anonymous
[not found] ` <6ib6t4$63f$1@goanna.cs.rmit.edu.au>
1998-05-06 0:00 ` Robert I. Eachus
1998-05-01 0:00 ` Samuel T. Harris
[not found] <matthew_heaney-ya023680003004981720560001@news.ni.net>
1998-05-01 0:00 ` Anonymous
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox