Alternatives
Some newer languages (such as Java) dispense with header files and instead use a naming scheme that allows the compiler to locate the source files associated with interfaces and class implementations. These languages (and perhaps others) preserve type information for functions in the object code, allowing the linker to verify that functions are used correctly.
COBOL and RPG IV have a form of include files called copybooks. Programmers "include" these into the source of the program in a similar way to header files, but they also allow replacing certain text in them with other text. The COBOL keyword for inclusion is COPY
, and replacement is done with a REPLACING ... BY ...
clause.
Fortran does not require header files per se. However, Fortran 90 and later has two related features: include statements and modules. The former can be used to share a common file containing procedure interfaces, much like a C header, although the specification of an interface is not required for all varieties of Fortran procedures. This approach is not commonly used; instead procedures are generally grouped into modules that can then be referenced with a use statement within other regions of code. For modules, header-type interface information is automatically generated by the compiler, and typically put into separate module (usually *.mod) files in a compiler-dependent format, although some compilers have placed this information directly into object files. Note that the language specification itself does not mandate the creation of any extra files, even though module procedure interfaces are almost universally propagated in this manner.
Read more about this topic: Header File
Famous quotes containing the word alternatives:
“The last alternatives they face
Of face, without the life to save,
Being from all salvation weaned
A stag charged both at heel and head:
Who would come back is turned a fiend
Instructed by the fiery dead.”
—Allen Tate (18991979)
“Clearly, society has a tremendous stake in insisting on a womans natural fitness for the career of mother: the alternatives are all too expensive.”
—Ann Oakley (b. 1944)
“The literal alternatives to [abortion] are suicide, motherhood, and, some would add, madness. Consequently, there is some confusion, discomfort, and cynicism greeting efforts to find or emphasize or identify alternatives to abortion.”
—Connie J. Downey (b. 1934)