Path: utzoo!utgpu!water!watmath!watdcsu!mackie From: mackie@watdcsu.waterloo.edu (Computer Systems Group) Newsgroups: comp.lang.pascal Subject: array-types passed by value-ANSI standard Keywords: array-types, ANSI Message-ID: <4816@watdcsu.waterloo.edu> Date: 20 Jun 88 18:39:28 GMT Distribution: na Organization: U of Waterloo, Ontario Lines: 50 I have a question that deals with passing arrays by value in the ansi standard. There seem to be two different interpretations to the matter in the standard so I'm wondering if there is an expert out there who can clarify the issue. The book I am using as reference is AMERICAN NATIONAL STANDARD PASCAL COMPUTER PROGRAMMING LANGUAGE - 1983 The issue involves when an array-type passed by value is considered undefined. First Interpretation : Section # 6.4.3.2 "A value of an array-type does not therefore exist unless all of its component values are defined. If the component-type has c values, then it follows that the cardinality of the set of values of the array-type is c raised to the power k." I interpret this as meaning that if you use an array in which any element is not defined, then the array should be treated as undefined ( so should generate an error when passed by value ); Second Interpretation : Section # 6.8.2.2 "The state of a variable or activation result when the variable or activation result does not have attributed to it a value specified by its type shall be designated UNDEFINED. If a variable posseses a structured type, the state of the variable when every component of the variable is totally-undefined shall be designated TOTALLY-UNDEFINED. Totally-undefined shall be synonymous with undefined for an activation result or a variable that does not possess a structured type." I interpret this as if one of the elements of an array is defined, then the array is considered to be defined. This is a recursive definition. This seems to be a contradiction to the first interpretation. Now to top this off, Test # 6.6.3.1-2 in the conformance section in VERSION 3.1 of the PASCAL VALIDATION SUITE allows passing of an array by value that is not completely defined. ( ie- it should not generate an error ) The equivalent test in Version 4.1 of the suite does the same as previous one except it totally defines the array before it is passed. Is there anyone who can offer an opinion on this problem?