From jkr@jkr.cc.rl.ac.uk  Fri Feb 23 14:27:25 2001
Received: from nameserv.rl.ac.uk (nameserv.rl.ac.uk [130.246.135.129])
	by dkuug.dk (8.9.2/8.9.2) with ESMTP id OAA91707
	for <SC22WG5@dkuug.dk>; Fri, 23 Feb 2001 14:27:25 +0100 (CET)
	(envelope-from jkr@jkr.cc.rl.ac.uk)
Received: from jkr.cc.rl.ac.uk (jkr.cc.rl.ac.uk [130.246.8.20])
	by nameserv.rl.ac.uk (8.8.8/8.8.8) with ESMTP id NAA20505
	for <SC22WG5@dkuug.dk>; Fri, 23 Feb 2001 13:27:24 GMT
Received: (from jkr@localhost)
	by jkr.cc.rl.ac.uk (8.8.8+Sun/8.8.8) id NAA22897
	for SC22WG5@dkuug.dk; Fri, 23 Feb 2001 13:29:12 GMT
Date: Fri, 23 Feb 2001 13:29:12 GMT
From: John Reid <jkr@rl.ac.uk>
Message-Id: <200102231329.NAA22897@jkr.cc.rl.ac.uk>
To: SC22WG5@dkuug.dk
Subject: Re: Iterpretation 22 (Use of NULL() as initialization): Draft response
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"


Dear WG5,
         Here is my next draft interpretation response. As far as
I know, this is the first attempt at a response to this one. I would
appreciate comments before I send it to J3, preferably to me in
private.

Cheers,

John. 



NUMBER: 000022
TITLE: Use of NULL() as initialization
KEYWORDS: NULL intrinsic, initialization, default initialization,
          DATA statement
DEFECT TYPE: Erratum
STATUS: J3 consideration in progress

QUESTION: Rules R429, R505 and R540 respectively describe the syntax for
default initialization of pointer components, pointer objects in type
declaration statements and pointer objects in DATA statements.  These rules
seem to indicate that NULL is to be considered a keyword in those contexts.
This has the surprising effect that the first example below is a standard
conforming program, while the second is not.  That is, in some contexts,
something that looks very much like a reference to an intrinsic function, is
in fact a keyword followed by parentheses.

Example 1:

      MODULE MOD
        INTRINSIC NULL
      END MODULE MOD

      PROGRAM PROG
        USE MOD, DISASSOCIATE=>NULL
        INTEGER, PARAMETER :: NULL = 17
        INTEGER :: J = NULL

        INTEGER :: I
        INTEGER, POINTER :: P => NULL(), P2
        DATA P2, I/NULL(), NULL/
        TYPE DT
          INTEGER, POINTER :: P => NULL()
        END TYPE DT
        TYPE DT2
          INTEGER, POINTER :: I
          INTEGER :: J
        END TYPE DT2
        TYPE(DT2) :: S = DT2(DISSASSOCIATE(), NULL), S2
        DATA S2/DT2(DISSASSOCIATE(), NULL)/
      END PROGRAM PROG

Example 2:

      MODULE MOD
        INTRINSIC NULL
      END MODULE MOD

      PROGRAM PROG
        USE MOD, DISASSOCIATE=>NULL

        INTEGER, POINTER :: P => DISASSOCIATE(), P2
        DATA P2/DISASSOCIATE()/
        TYPE DT
          INTEGER, POINTER :: P => DISASSOCIATE()
        END TYPE DT
      END PROGRAM PROG

In some places in the scoping unit of PROG example 1, NULL() is used to
specify initialization or default initialization, while in others NULL is
a named constant, and DISSASSOCIATE() must be used to specify initialization.

1) Is example 1 a standard conforming program?

2) Is example 2 a standard conforming program?

3) Was it the intent of the committee that, within the contexts of R429,
R505 and R540, NULL should be treated strictly as a keyword rather than as a
reference to an intrinsic function?

ANSWER:

The intention is that the intrinsic function NULL be referenced with no
arguments in initialization contexts. This is made clear in the middle
of page 49 in the paragraph that begins 'If <initialization>'
[49:20-21] and also in 7.1.4.1. If the intrinsic function has been
renamed, the new name should be used. Edits are provide to correct 
the mistake.

Example 1 does not conform to the standard because NULL is used both as
the name of an integer constant and the name of the intrinsic
function.

Example 2 conforms to the standard.


EDITS:

Page 39, subclause 4.4.1, replace the second line of R429 [39:20] by
                     <<or>> => <null-name>()
          Constraint: <null-name>() shall be a reference to the  
                 intrinsic function NULL.

Page 47, subclause 5.1, replace the second line of R505 [47:37] by
                     <<or>> => <null-name>()
          Constraint: <null-name>() shall be a reference to the  
                 intrinsic function NULL.

Page 49, subclause 5.1, in the paragraph that begins 'If
     <initialization>' [49:20-21], replace NULL() by <null-name>() 
     twice. 
 
Page 62, subclause 5.2.10, replace the fifth line of R540 [62:19] by
                     <<or>> <null-name>()
     and after rule R540 [62:20+] add
          Constraint: <null-name>() shall be a reference to the  
                 intrinsic function NULL.

Page 62, subclause 5.2.10, in the penultimate line of the page [62:48],
      replace NULL() by <null-name>(). 

Page 63, subclause 5.2.10, in lines 1, 7 and 10 of the page [63:1,7,10],
      replace NULL() by <null-name>(). 

SUBMITTED BY: Henry Zongaro

HISTORY: 98-151   m145 Submitted
