Go to the first, previous, next, last section, table of contents.


Names

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 (`_') appended by g77, to generate code that is compatible with f2c. 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 names.

However, use of the `-fno-underscoring' option 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.

When `-funderscoring' is in force, any name (external or local) that already has at least one underscore in it is implemented by g77 by appending two underscores. (This second underscore can be disabled via the `-fno-second-underscore' option.) External names are changed this way for f2c compatibility. 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 debugging.

For example:

Max_Cost = 0

Here, a user would, in the debugger, refer to this variable using the name `max_cost__' (or `MAX_COST__' or `Max_Cost__', 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 `-fno-underscoring' 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.

For example:

Foo = 9.436

Here, it is normally the case that the variable assigned will be named `foo'. 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.

Also:

Call Foo

This would normally call a procedure that, if it were in a separate C program, be defined starting with the line:

void foo_()

However, g77 command-line options could be used to change the casing of names, resulting in the name `FOO_' or `Foo_' being given to the procedure instead of `foo_', and the `-fno-underscoring' option could be used to inhibit the appending of the underscore to the name.


Go to the first, previous, next, last section, table of contents.