Download presentation
Presentation is loading. Please wait.
1
Functions & Subroutines HTML version DFMain.chm
2
Types of subprograms Internal External Module Pure Elemental Recursive Optional arguments Generic Defined operators Defined assignment
3
INTENT Type Declaration Statement: type, [att-ls,] INTENT (intent-spec) [, att-ls] :: d-arg [, d-arg]... Statement: INTENT (intent-spec) [::] d-arg [, d-arg]... intent-spec IN, OUT, or INOUT Intent.f95Intent.exe
4
CONTAINS Separates the body of a main program, module, or external subprogram from any internal or module procedures it may contain. It is not executable. Thus, procedures following the CONTAINS statement are local ( internal ) procedures of the host program.
5
Procedure Interfaces Kind of Procedure Interface External procedure Implicit 1 Module Procedure Explicit Internal Procedure Explicit Intrinsic Procedure Explicit Dummy Procedure Implicit 1 Statement function Implicit 1 Unless an interface block is supplied for the procedure.
6
Explicit Interfaces are required for routines with optional dummy arguments. dummy arguments that are assumed- shape arrays, pointers, or targets. result that is array-valued or a pointer (functions only). result whose length is neither assumed nor a constant (character functions only)
7
Explicit Interfaces are required for calling routines with argument keywords. generic names. Defined assignments (subroutine only). Defined operators ( functions only ). Pure functions.
8
Recursive Procedures If a function is directly recursive and array valued, the keywords RECURSIVE and RESULT must both be specified in the FUNCTION statement. Recursive.f95Recursive.exe Fibonacci.f95Fibonacci.exe
9
Optional Arguments Optional arguments are specified by the OPTIONAL attribute. Use the intrinsic function PRESENT to determine whether an actual argument is present. Explicit procedure interfaces must be used. Optional.f95Optional.exe
10
Generic routines GenericS.f95GenericS.exe
11
Defined Operators GenericO.f95GenericO.exe Generic1.f95Generic1.exe
12
Defined Assignments Pure Procedures Elemental Procedures
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.