Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Fortran 90 Compiler for HP-UX: Fortran 90 Programmer's Guide > Chapter 3 Controlling data storage

Disabling implicit typing

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

By default, HP Fortran 90 uses implicit typing to determine the type of a variable or function that has not been declared with a type declaration statement. That is, the type of an undeclared entity is determined by the first letter of its name: if the letter is in the range I - N, the entity is of type integer; otherwise, it is of type real.

Although implicit typing is mandated by the Standard, its use can become a source of runtime bugs because implicit typing allows the inadvertent use of undeclared variables or functions. For the sake of illustration, consider a program that calls a nonintrinsic library function named foo. Assume that:

  • The default typing rules are in effect.

  • foo returns an integer.

  • The programmer has not declared the return type of foo and has assigned its return value to a variable of type real.

Experience has shown that this is not an unlikely scenario and that it can produce bad results.

The Standard provides the IMPLICIT NONE statement to override implicit typing. But the IMPLICIT NONE statement is limited in scope to the program unit in which it appears. To force explicit typing for all files specified on the compile line, use the +implicit_none option. This option disables implicit typing; that is, all variables, arrays, named constants, function subprograms, ENTRY names, and statement functions (but not intrinsic functions) must be explicitly declared.

Using this option is equivalent to specifying IMPLICIT NONE for each program unit in each file specified on the f90 command line. However, the +implicit_none option does not override any IMPLICIT statements in the source file. The HP Fortran 90 Programmer's Reference describes the implicit typing rules, the IMPLICIT NONE statement, and the +implicit_none option.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.