|No Initialization? PAUL@tdr.com (Paul Robinson) (1994-10-03)|
|From:||Paul Robinson <PAUL@tdr.com>|
|Keywords:||Fortran, linker, comment|
|Organization:||Tansin A. Darcos & Company, Silver Spring, MD USA|
|Date:||Mon, 3 Oct 1994 01:41:32 GMT|
In an article about linkers, the moderator writes (about linker support
for calling an initializer before the user's code):
> [C++ needs this feature for global class instances with initializers.
> Given the wild success of C++, we'll probably be seeing more linker
> support. Fortran doesn't need initialization code, although some
> compilers (one of the PDP-10 compilers, for example) used it to
> initialize large sparse data arrays and make the object file smaller.
'Fortran doesn't need initialization code'. Somehow I think this should
go into my famous statements file along with Peter Norton's remark, "256K
[of memory] ought to be enough for most users."
I've seen at least four different manufacturer's FORTRAN compilers: DEC
PDP, IBM MVS 370, Music VM/SP, Univac 90/60, CDC NOS, Microsoft. *All* of
them have initializations. Most involve files, such as:
- Assigning the unit buffers (5, 6 and 7) to sysdata, sysin and sysout
- Opening the "Dayfile" job log (CDC).
- Assiging file unit n where n is 1 to 99, to FCB name FTnnF001 and
FTnnF002 (if multiple files were used) (IBM MVS)
- Assigning file 9 to keyboard and 5 to display (Music)
- Assigning file numbers to terminal (Microsoft, PDP)
This is in addition to other tasks such as requesting memory for certain
buffers and tables at run time (because the FORTRAN Library could be
installed as a shared memory library, each user would have to have
private memory for this purpose (Univac)).
I haven't found a FORTRAN yet that didn't have some initialization required
at run time.
[You miss my point. I know a lot about what a Fortran runtime needs,
having written one singlehandedly (Interactive's INfort for the PDP-11)
some time ago. But that sort of initialization is in the library stub
that either calls or is called from the main program. In fact, all the
INfort initialization needed to do was to stash the command line
arguments. The I/O was all done on demand on the first reference to each
The stuff I was discussing that Fortran doesn't need is initialization
code generated by the compiler for a specific program. For example, I've
seen cases where this:
generated a stub that actually ran the do-loop either in the linker or at
runtime. Clearly Fortran can get along without that -- in INfort I ran
the loop in the compiler and generated plain old data in the object file.
C++ does need compiler-generated init code for global instances of classes
with constructors. -John]
Return to the
Search the comp.compilers archives again.