[J3] Does Note 3 on page 75 violate C762?

Malcolm Cohen malcolm at nag-j.co.jp
Tue Jun 2 22:03:29 EDT 2020


Hi Steve,

 

Thanks for your comment. You are correct in that the example on page 75 is invalid. This example should be corrected.

 

The restriction in C762 is intentional. It was inserted by interp F03/0072, published in Fortran 2003 Corrigendum 2 (probably 2006). Unfortunately, when inserting this correction, no-one noticed that 50 pages away there was an example that needs correcting.

 

Cheers,

-- 

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

 

From: J3 <j3-bounces at mailman.j3-fortran.org> On Behalf Of Steven G. Kargl via J3
Sent: Wednesday, June 3, 2020 10:05 AM
To: j3 at mailman.j3-fortran.org
Cc: Steven G. Kargl <kargl at troutmask.apl.washington.edu>
Subject: [J3] Does Note 3 on page 75 violate C762?

 

(This has been posted to comp.lang.fortran for discussion)

The document I have is

WD 1539-1, J3/18-007r1 (F2018 Interpretation document)

An example in https://stackoverflow.com/questions/62005934
has sparked debate on what the Fortran standard requires.

Does Note 3 on page 75 violate C762?

C762 (R737) If component-initialization appears, every type parameter
and array bound of the component shall be a colon or constant expression.

>From Note 3, the derived type definition is

TYPE MEMBER(NAME_LEN)
INTEGER, LEN :: NAME_LEN
CHARACTER(LEN = NAME_LEN) :: NAME = ''
INTEGER :: TEAM_NO, HANDICAP = 0
TYPE(SINGLE_SCORE), POINTER :: HISTORY => NULL ( )
END TYPE MEMBER

Is NAME_LEN considered to be a constant expression in that
a type declaration is of the form

TYPE(MEMBER(9)) LEAGUE(36)

Here, NAME_LEN has the value of 9. Should C762 be modified to 

C762 (R737) If component-initialization appears, every type parameter
and array bound of the component shall be a colon, constant expression,
or a type-param-name.

Also note, that NAME_LEN will always be defined when the derived
type definition is used in a type declaration statement. This
is guaranteed by

C792 (R754) There shall be at most one type-param-spec corresponding to
each parameter of the type. If a type parameter does not have a default
value, there shall be a type-param-spec corresponding to that type
parameter.

In any event, either C762 or Note 3 needs to be modified.

-- 
Steve

----- End forwarded message -----

-- 
Steve



Disclaimer

The Numerical Algorithms Group Ltd is a company registered in England and Wales with company number 1249803. The registered office is: Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom. Please see our Privacy Notice <https://www.nag.co.uk/content/privacy-notice>  for information on how we process personal data and for details of how to stop or limit communications from us.

This e-mail has been scanned for all viruses and malware, and may have been automatically archived by Mimecast Ltd, an innovator in Software as a Service (SaaS) for business.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20200603/998c7a9f/attachment.htm>


More information about the J3 mailing list