Path: utzoo!utgpu!watserv1!watmath!att!dptg!ulysses!andante!princeton!udel!wuarchive!usc!ucsd!hub.ucsb.edu!ucsbuxa!3003jalp From: 3003jalp@ucsbuxa.ucsb.edu (Applied Magnetics) Newsgroups: comp.lang.fortran Subject: Re: archiving block data subroutines... Message-ID: <7419@hub.ucsb.edu> Date: 27 Nov 90 17:26:29 GMT References: Sender: news@hub.ucsb.edu Lines: 45 The following is from Harbison and Steele, "C a Reference Manual", 1st ed. section 4.8. Emphasis mine. ...It is a well-known deficiency in C that defining and referencing occurrences of external declarations are difficult to distinguish. In general, compilers use one of three complicated schemes to determine when a top level declaration is a defining occurrence. ... 4.8.2 The FORTRAN "named COMMON" Solution This scheme is so named because it is related to the way multiple references to a FORTRAN COMMON block are merged into a single defining occurrence in some FORTRAN implementations. ...At link time, all external declarations for the same identifier (in all C object files) are combined and a single defining occurrence is conjured, NOT NECESSARILY ASSOCIATED WITH ANY PARTICULAR FILE. If any declaration specified an initializer, that initializer is used to initialize the data object. (If several declarations did, the results are unpredictable.) This solution is the most painless for the programmer, the most demanding on system software and the most likely to lead to confusion on the part of people reading a program. It is hypothesized that the presence of a linker on the PDP-11 that handled these COMMON declarations lured early C implementors into depending on this capability End of quote. THAT's the problem. We're all stuck with loaders that recognize 1) REFERENCED external symbols, which must be resolved by loading additional defining modules, 2) DEFINED external symbols, which must not conflict among themselves and are loaded to resolve the former kind, and finally 3) COMMON external symbols, which are collected during the loading phase and finally fused together without loading anything else. I assume that the COMMON symbol semantics originated at IBM. The ANSI F.77 standard itself explicitly declines to address those issues (sect. 1.3.2). Your implementation can do what it wants to you. In the future, I think that I will keep my block datas in SOURCE form and require the programmer to INCLUDE a copy exactly once in his source file. The INCLUDE statement was discussed eralier in this group. It's not ANSI, but it's MIL-something. Almost all compilers have some form of it. They're all different, of course, but the functionality is there, so you can port. --Pierre Asselin, R&D, Applied magnetics Corp. I speak for me.