(j3.2006) POINTER initializations in BLOCK DATA

Malcolm Cohen malcolm
Wed Apr 22 00:44:32 EDT 2009


Robert Corbett wrote:

> Is the following code fragment conforming Fortran 2008:
>   
I break this into two questions:

(1) may one put a CLASS(*) pointer in a COMMON block?

(2) if so, then is there any reason prohibiting its initialisation in 
that COMMON block?

I don't break (2) into the third possibility of allowing initialisation 
but only to point to objects that are normally allowed in COMMON, since 
that would not make sense unless one was not permitted to point the 
pointer at such an object in a pointer assignment statement either.

I don't see anything in F2003 that forbids (1).

Given the initialisation extension we added in F2008, that would also 
allow (2).

However, I don't think we deliberately allowed CLASS(*) pointers in 
COMMON; why would we allow those and not allow other polymorphic 
pointers (or indeed, nonpointer objects of nonsequence type).

So this looks to me like a mistake in F2003; due to the nature of the 
beast, CLASS(*) slipped through the cracks of the COMMON requirements 
without us noticing.

I have submitted an interp request (paper 09-204).

Cheers,
-- 
.....................Malcolm Cohen, Nihon NAG, Tokyo.





More information about the J3 mailing list