From: "James Burnell, WVU Comp/Ele Engr" <UN025523@WVNVAXA.WVNET.EDU>
Subject: Help with VAX/VMS Ada
Date: Mon, 5 Aug 1991 15:24 EDT [thread overview]
Message-ID: <01G90W969NPC8WWNZR@WVNVMS.WVNET.EDU> (raw)
Dear fellow Ada users,
I am taking a summer course in Ada (CompSci 2 at West Virginia
University). My teacher gave us an assignment to implement a Vector as
a discriminated record in a generic package as follows (an excerpt from
the specification she gave us):
generic
type Vector_Element is private;
Zero, One : Vector_Element;
with function "+" (Left, Right : Vector_Element) return Vector_Element
is <>;
with function "-" (Left, Right : Vector_Element) return Vector_Element
is <>;
with function "*" (Left, Right : Vector_Element) return Vector_Element
is <>;
package Vector_Package is
type Vector (Lower_Bound, Upper_Bound : Integer := 0) is limited private;
-- Appropriate operations deleted....
private
type Vector_Array is array (Integer range <>) of Vector_Element;
type Vector (Lower_Bound, Upper_Bound : Integer := 0) is
record
The_Vector : Vector_Array (Lower_Bound .. Upper_Bound)
:= (others => Zero);
end record;
end Vector_Package;
The package compiles without error. But an instantiation, for example,
with Vector_Package;
package Int_Vect_Pack is new Vector_Package (Integer, 0, 1);
produces the following compiler warning:
2 package Int_Vect_Pack is new Vector_Package (Integer, 0, 1);
........1
%ADAC-I-CONS_OR_NUM_ERR, (1) (For Vector from Vector_Package at line 33)
CONSTRAINT_ERROR or NUMERIC_ERROR will be raised here [LRM 11.1(5-6),
F.9.5]
during evaluation related to record type Vector at line 2 (from
Vector_Package at line 33)
%ADAC-I-ENDDIAGS, Ada compilation completed with 1 diagnostic
LRM 11.1(5-6) is simply an explanation of Constraint_Error and
Numeric_Error; F.9.5 I have included below (used without permission):
F.9.5 Implementation Limits
Limits Description
-------------------------------------------------------------------------------
32 Maximum number of formal parameters in a subprogram or entry
declaration that are of an unconstrained type.
120 Maximum identifier length (number of characters).
120 Maximum number of characters in a source line.
245 Maximum number of discriminants for a record type.
246 Maximum number of formal parameters in an entry or subprogram
declarations.
255 Maximum number of dimensions in an array type.
1000 Maximum number of library units and subunits in a program library
or executable program.
32757 Maximum number of objects declared with PSECT_OBJECT pragmas.
65535 Maximum number of enumeration literals in an enumeration type
definition.
65535 Maximum number of characters in a value of the predefined type
STRING.
65535 Maximum number of frames that an exception can propagate.
65535 Maximum number of lines in a source file.
2^31 - 1 Maximum number of buts in any object.
As you can see, none of these is an _obvious_ reason for Constraint_Error to be
raised. Furthermore, Constraint_Error is NOT raised if the default values for
type Vector are removed.
My teacher is researching this also, but I (and she) would appreciate your
input. Why is Constraint_Error raised in this situation?
Please send responses to me. Thanks for your time.
Sincerely,
Jim Burnell
PREFERRED: UN025523@WVNVMS.WVNET.EDU | AdaNet: jburnell@asv2.wvnet.edu
BITNET : UN025523@WVNVMS | -- Insert STANDARD.DISCLAIMER
next reply other threads:[~1991-08-05 19:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1991-08-05 19:24 James Burnell, WVU Comp/Ele Engr [this message]
-- strict thread matches above, loose matches on Subject: below --
1991-08-12 19:39 Help with VAX/VMS Ada cis.ohio-state.edu!zaphod.mps.ohio-state.edu!rpi!bu.edu!inmet!stt
1991-08-14 4:54 Mike Feldman
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox