From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=BAYES_00,TO_NO_BRKTS_PCNT autolearn=no autolearn_force=no version=3.4.5-pre1 Date: Mon, 5 Aug 1991 15:24 EDT From: "James Burnell, WVU Comp/Ele Engr" Subject: Help with VAX/VMS Ada Message-ID: <01G90W969NPC8WWNZR@WVNVMS.WVNET.EDU> List-Id: 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