(j3.2006) (SC22WG5.3673) [ukfortran] N1755: Request for new features from MPI Forum
Robert Corbett
Robert.Corbett
Thu Nov 13 03:02:26 EST 2008
Malcolm Cohen wrote:
> J3 readers, please remember to change your reply to WG5 when it's a WG5
> message, otherwise it won't get through...
>
> Robert Corbett wrote:
>
>>N.M. Maclaren wrote:
>>
>>
>>>Aargh! No! C 'const'! It has NOT been a success - in fact, to describe
>>>it as a paving slab on the road to hell would be fair. [ Yes, I am referring
>>>to the saying that the road to hell is paved with good intentions. ]
>>>
>>
>>The best example of that in Fortran 2003 is the PROTECTED attribute.
>>A casual reader of the standard is likely to believe that a variable
>>with the PROTECTED attribute cannot be modified outside of the module
>>in which it is contained. A careful reading and the interps that
>>have been issued make it clear that PROTECTED is a promise made by
>>the programmer that he doesn't modifiy the variable outside of the
>>module
>
> This is not correct; to call it a "promise made by the programmer" is
> not even remotely accurate.
The committe might have intended PROTECTED to be something other than
a promise made by the programmer, but the standard as written makes it
exactly that. Just because INTENT(IN) has a similar defect does not
make it any the less true.
The standard as written allows a compiler to assume that a variable
that has the PROTECTED attribute is not definable outside the module,
but it allows programs to be written that define the variable outside
of the module and it does not require the processor to detect the error.
If a programmer writes a program that defines the variable outside the
module, it is not a standard-conforming program, and so a
standard-conforming processor is free to do anything whatever when
compiling or executing the program. The onus is on the programmer to
avoid defining the variable outside the module.
Bob Corbett
More information about the J3
mailing list