Node: Names, Next: Common Blocks, Previous: Functions, Up: Debugging and Interfacing
Fortran permits each implementation to decide how to represent names as far as how they're seen in other contexts, such as debuggers and when interfacing to other languages, and especially as far as how casing is handled.
External names--names of entities that are public, or "accessible",
to all modules in a program--normally have an underscore (
to generate code that is compatible with
External names include names of Fortran things like common blocks,
external procedures (subroutines and functions, but not including
statement functions, which are internal procedures), and entry point
However, use of the
disables this kind of transformation of external names (though inhibiting
the transformation certainly improves the chances of colliding with
incompatible externals written in other languages--but that
might be intentional.
-funderscoring is in force, any name (external or local)
that already has at least one underscore in it is
g77 by appending two underscores.
(This second underscore can be disabled via the
External names are changed this way for
Local names are changed this way to avoid collisions with external names
that are different in the source code--
f2c does the same thing, but
there's no compatibility issue there except for user expectations while
Max_Cost = 0
Here, a user would, in the debugger, refer to this variable using the
as described below).
(We hope to improve
g77 in this regard in the future--don't
write scripts depending on this behavior!
Also, consider experimenting with the
option to try out debugging without having to massage names by
hand like this.)
g77 provides a number of command-line options that allow the user
to control how case mapping is handled for source files.
The default is the traditional UNIX model for Fortran compilers--names
are mapped to lower case.
Other command-line options can be specified to map names to upper
case, or to leave them exactly as written in the source file.
Foo = 9.436
Here, it is normally the case that the variable assigned will be named
This would be the name to enter when using a debugger to
access the variable.
However, depending on the command-line options specified, the
name implemented by
g77 might instead be
FOO or even
Foo, thus affecting how debugging is done.
This would normally call a procedure that, if it were in a separate C program, be defined starting with the line:
g77 command-line options could be used to change the casing
of names, resulting in the name
Foo_ being given to the
procedure instead of
foo_, and the
could be used to inhibit the appending of the underscore to the name.