(j3.2006) declaring procedure pointers using interface blocks
Robert Corbett
robert.corbett
Wed Jul 16 03:39:45 EDT 2014
Last week, I was asked if the program
PROGRAM MAIN
INTERFACE
REAL FUNCTION F()
END FUNCTION
END INTERFACE
POINTER F
F => F
END
is standard conforming. Normally, I rely on clause 16.3.1 to answer questions
like this one, but the current version of that text does not deal with procedure
pointers. I told the person who asked the question that I thought the program
should not be standard conforming, because F is declared to be both a pointer
and an external procedure in the scope of the program (see 12.4.3.2p5 of
14-007r1). The person who asked the question said that gfortran and ifort
accept the code. I checked the book Modern Fortran Explained and found the
example in Section 13.6.1, which gives a similar example. I assume that in this
case, the example in Modern Fortran Explained trumps the standard and that
12.4.3.2p5 needs revision.
Robert Corbett
More information about the J3
mailing list