From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a3471634bf10bf8d,start X-Google-Attributes: gid103376,public From: Jay Sachs Subject: private type discriminants ignored? Date: 1998/04/24 Message-ID: #1/1 X-Deja-AN: 347306222 X-Face: 6!-I&o^[[HP+0~O~}d2Zf@Pbof:|>j5^*W$QOR"&)JYcHT.@-"AhAXLg3vioV79Ri3JMp/a e3QD@Z$1Ot@'j1/A Mime-Version: 1.0 (generated by tm-edit 7.108) Content-Type: text/plain; charset=US-ASCII Organization: Williams College, Williamstown, MA Newsgroups: comp.lang.ada Date: 1998-04-24T00:00:00+00:00 List-Id: 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