(j3.2006) Adventures in sections of constant arrays

Cohen Malcolm malcolm
Mon Mar 6 23:43:01 EST 2017


<<<
Intel Fortran has a similar option, but that is entirely beside the
point. My question is whether the standard ought to require a compiler
to support this usage.
>>>

Yes  this is standard-conforming code.  There is no question.

The very similar example passing an array constant, instead of a character 
string constant, is standard Fortran 90.  Indeed, the NAG compiler does just 
fine with the array constant version, because we do not put array constants 
in readonly memory, specifically so that this standard-conforming case will 
work.

Fortran 2003 added the ability to pass character string scalars to character 
string arrays.  The NAG compiler doesn't make those go into writable memory 
at the moment, that's why this example crashes.  I guess we'll have to fix 
that.

Though I must admit my first reaction to seeing this kind of code is Don't 
Do That!  (Passing character string scalars to character array dummies is a 
bad feature, added only to make life easier for C programmers.)

Cheers,
-- 
.............Malcolm Cohen, NAG Oxford/Tokyo. 




More information about the J3 mailing list