(j3.2006) INQUIRE by output list

Malcolm Cohen malcolm
Wed Aug 21 21:01:16 EDT 2013


>>> The INQUIRE statement form used to determine a record size has the
>>> syntax form
>>>
>>>    INQUIRE (IOLENGTH=<scalar-int-variable>)  <output-item-list>
>>>
>>> The <output-item> can be a simple variable name.  But the rules for the
>>> syntax term  <output-item> appear to require that the variable be
>>> defined.
>>
>> Sorry, not seeing it.
>>
>> "A data object is referenced when its value is required during execution."
>
>We also say
>
>"An expression represents either a data reference or a computation, and
>its value is either a scalar or an array."
>
>and <output-item> traces back to an expression.

Precisely, which is why I wrote what I wrote.

In this case the expression *IS* a data object, and the 64 yen question is 
whether the value of the expression, and thus of the data object since the data 
object is the whole of the expression, is required.  Some processors might 
require the value, some processors might not require the value.

>I agree that in this case it is not necessary for the <output-item> to
>be defined,

Well, it is not necessarily necessary at least...

>It is certainly
>possible to tell the compiler "make an exception in the case of INQUIRE
>that <output-item> can be undefined".

It seems unlikely to me that any compiler will be processing the 
<output-item-list> of an INQUIRE in exactly the same way as it would process it 
for a data transfer statement.  Especially in the case of arrays, function 
references, and i/o-implied do, that would entail a lot of unnecessary work.

>  But should we say that in the
>standard as well? Even as just a Note.

Saying it as a Note has little benefit over saying it on an email list - it 
needs to be said in normative text if you want to prohibit compilers from (e.g.) 
doing compressed i/o, or other cases where it could be desirable that the i/o 
length might actually depend on what the value is.  Requirements must *always* 
be in normative text.

Frankly, I am not convinced that we even *want* to restrict compilers in that 
way.

We could leave it as is, or clarify it by adding something like "If an 
<output-item> in an INQUIRE IOLENGTH= statement is a data object designator, 
whether its value is required is processor dependent.".

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




More information about the J3 mailing list