(j3.2006) Implicit declaration and BLOCK
Malcolm Cohen
malcolm
Tue Jul 18 03:40:14 EDT 2017
Van Snyder asserts:
But concerning implicit declaration, 8.7p4 says "The data entity is
treated as if it were declared in an explicit type declaration; if the
outermost inclusive scope in which it appears is not a type definition,
it is declared in that scope, otherwise it is declared in the host of
that scope."
A BLOCK construct isn't a type definition, so read this as "The data
entity is treated as if it were declared in an explicit type
declaration; it is declared in the outermmost inclusive scope in which
it appears." If it only appears in a BLOCK construct, that is the
outermost inclusive scopes in which it appears.
The last sentence is incorrect, as already explained (in the message to which this purports to be a reply). A BLOCK construct cannot by itself be the whole of an inclusive scope, as it is never a
nonblock scoping unit plus every block scoping unit whose host is that scoping unit or that is nested within such a block scoping unit
seeing as how ?block? is definitively not ?nonblock?. Let alone the ?outermost? one.
That means that an inclusive scope, in contexts where BLOCK is permitted, is either the main program scoping unit plus every BLOCK nested within it, or a subroutine or function subprogram scoping unit, plus every BLOCK nested within it.
Thus the followup message, which states
If we meant that implicitly-declared
variables that appear only in BLOCK constructs are not explicitly
declared in the outermost scope in which they appear, i.e., are not
construct entities, 8.7p4 should have included both type definitions and
BLOCK constructs in the conditions under which they are declared in the
host of the scope. Adding that now would be an incompatibility that
might invalidate existing programs.
is also mistaken. The existing 8.7p4 actually states clearly that the entities are ?as if? declared in the outermost inclusive scope, which is going to mean in the main program or subprogram. So we are not talking about ?Adding that now?, we are talking the state of affairs as they actually have been all along since publication of F2008.
Cheers,
--
..............Malcolm Cohen, NAG Oxford/Tokyo.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.j3-fortran.org/pipermail/j3/attachments/20170718/7a3d89cf/attachment.html
More information about the J3
mailing list