09/28/82 fortran_77.differences.info This info segment describes the differences between the languages accepted by the Multics FORTRAN compiler under the ansi66 and ansi77 options. The implementation of FORTRAN 77 is not yet complete, so this list of differences may grow with future releases. The differences described in the following paragraphs are: zero trip DO loop character array layout unformatted file layout data type restriction for common and equivalence substring references concatenation assumed size character strings default character string length descriptors for character arguments zero trip DO loop: Under the ansi77 option, the semantics of the DO statement have been changed to conform with the FORTRAN 77 standard. This new interpretation differs from the ansi66 DO statement in two ways. The first and most important difference is that the range of a DO loop may be executed zero times. That is, the statements which comprise the loop may be skipped altogether. For example, the range of the statement DO 300 I = M1, M2, M3 will be skipped if M1 > M2 and M3 > 0, or if M1 < M2 and M3 < 0. If the range is not executed, the DO variable has the initial value (M1). Under the ansi66 option, the range of a DO loop is always executed at least once. The second difference is that the increment value (M3 in the statement above) is saved at the time the DO statement is encountered, and this saved value is used to increment the DO variable. Under the ansi66 option, the increment value may be changed within the loop if it is a simple variable or array element. Example: N = 0 DO 200 I = 1, 10 J = I DO 200 K = 5, 1 L = K 200 N = N + 1 201 CONTINUE If the above statements are compiled under the ansi77 option and executed, the result is I = 11, J = 10, K = 5, and N = 0. The value of L is not defined. If the same statements are compiled under the ansi66 option and executed, the result is I = 11, J = 10, K = 6, L = 5, and N = 10. character array layout: Under the ansi77 option, character data in Multics FORTRAN conforms to the FORTRAN 77 standard. The most significant difference from character data under the ansi66 option is that character strings are unaligned, i.e. not necessarily beginning on a word boundary. This distinction is most important in dealing with arrays of character data: each array element now immediately follows the preceding one with no intervening pad characters. In the old (ansi66) implementation of character data, each array element is aligned on a word boundary by preceding the array element with 0 to 3 pad characters. Example: Consider the array aleph, declared as follows: character*3 aleph (4) In the old (ansi66) implementation, aleph is represented in storage as follows: --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- | | | |XXX| | | |XXX| | | |XXX| | | |XXX| | XXX| XXX| XXX| XXX| | | | |XXX| | | |XXX| | | |XXX| | | |XXX| --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- [ aleph (1) ] [ aleph (2) ] [ aleph (3) ] [ aleph (4) ] In the new (ansi77) implementation, aleph is respresented as follows: --- --- --- --- --- --- --- --- --- --- --- --- | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --- --- --- --- --- --- --- --- --- --- --- --- [ aleph (1) ] [ aleph (3) ] [ aleph (2) ] [ aleph (4) ] unformatted file layout: As a result of the new storage layout for character data with the ansi77 option, the format of data read and written by unformatted I/O statements has also changed. Unformatted files which contain character data written by an ansi66 program may be read (and converted, if desired) using the technique described in fortran_77.conversion.info. Only unformatted files containing character data are affected by this change. data type restriction for common and equivalence: Under the ansi77 option, a new restriction on the types of variables that may appear in common blocks and equivalence groups is imposed. If any of the items in a common block or equivalence group are character data, all items in that common block or equivalence group must be character data. In other words, character and non-character data may not be mixed in the same common block or equivalence group. substring references: Substring references are available under the ansi77 option. A substring reference specifies a contiguous section of a character variable or character array element, and may appear in any context that a character variable or array element may appear. The form of a substring reference is: var (first : last) or arr (sub1, ..., subn) (first : last) where var is a character variable, arr is a character array, and (sub1, ..., subn) is the subscript information for an array reference. The items first and last are integer valued expressions; first gives the index of the first character included in the substring, and last gives the index of the last character included in the substring. If first is omitted, 1 (the first character) is assumed; if last is omitted, the length of the string (the last character) is assumed. The substring reference is in error unless the following relation is satisfied: 1 <= first <= last <= length of string Examples: In the following examples, suppose atoe is a character*5 variable with the value "abcde". atoe (3:5) "cde" atoe (2:2) "b" atoe (3:2) ERROR atoe (:) "abcde" concatenation: Character string concatenation is a defined operation under the ansi77 option. The concatenation operator is //, and is higher in precedence than the relational and logical operators. Expressions involving multiple concatenations may be parenthesized, but the parentheses do not alter the value of the expression. Only character data may appear as an operand of a concatenation operator. Examples: In the following examples, suppose that atoe is a character*5 variable with the value "abcde", and vtoz is a character*5 variable with the value "vwxyz". atoe // vtoz "abcdevwxyz" atoe (2:3) // vtoz (3:3) "bcx" atoe (3:3) // vtoz (2:2) // atoe (4:4) "cwd" assumed size character strings: Under the ansi77 option, the length of a dummy argument, named constant, or function subprogram of type character may be given as "(*)" in the declarative statement. For a dummy argument, the "(*)" length is defined as the length of the corresponding actual argument. For a named constant, the "(*)" length is defined as the length of the constant expression which defines the named constant. For a function subprogram, the length of the value returned is determined by the declarative statements of the program unit in which the function subprogram is called. default character string length: Under the ansi77 option, the default length of character data has been changed from 8 to 1. The default length is used whenever a name is declared to be of type character and no length is specified. descriptors for character arguments: Under the ansi77 option, standard Multics argument descriptors are generated for all CALL statements and references to external functions which contain arguments of type character. ----------------------------------------------------------- Historical Background This edition of the Multics software materials and documentation is provided and donated to Massachusetts Institute of Technology by Group BULL including BULL HN Information Systems Inc. as a contribution to computer science knowledge. This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology, Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell BULL Inc., Groupe BULL and BULL HN Information Systems Inc. to the development of this operating system. Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970), renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership of Professor Fernando Jose Corbato. Users consider that Multics provided the best software architecture for managing computer hardware properly and for executing programs. Many subsequent operating systems incorporated Multics principles. Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. . ----------------------------------------------------------- Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without fee is hereby granted,provided that the below copyright notice and historical background appear in all copies and that both the copyright notice and historical background and this permission notice appear in supporting documentation, and that the names of MIT, HIS, BULL or BULL HN not be used in advertising or publicity pertaining to distribution of the programs without specific prior written permission. Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc. Copyright 2006 by BULL HN Information Systems Inc. Copyright 2006 by Bull SAS All Rights Reserved