Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Is this standard-conforming code?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Craig Dedo  
View profile  
 More options Apr 16 2008, 9:11 am
Newsgroups: comp.lang.fortran
From: "Craig Dedo" <cd...@wi.rr.com>
Date: Wed, 16 Apr 2008 08:11:19 -0500
Local: Wed, Apr 16 2008 9:11 am
Subject: Re: Is this standard-conforming code?

"John" <gh14...@yahoo.com> wrote in message news:fu4ru9$dbi$1@aioe.org...
> Is the below code standard conforming?  I have one group saying it is and
> another saying it isn't.  Both are very knowledgeable about Fortran. One
> compiler compiles with no errors, but another flags an error.  Of course, you
> can always move the "real :: z(t%n)" below the "type (tt) :: t" to avoid any
> problem, but I am concerned about the order shown.

> Thanks,
> John

    No, it is not standard conforming.  Using the name of a derived type before
it is defined explicitly violates the rules in section 5.1.1.1 of Fortran 2003.
Here is the relevant text:

[Begin quote]
5.1.1.1 TYPE
A TYPE specifier is used to declare entities of a derived type.

Where a data entity id declared explicitly using the TYPE specifier, the derived
type shall have been defined previously in the scoping unit or be accessible
there by use or host association.
[End of quote]

    There is an exception later in the paragraph for function results.

> module test_module
> implicit none

>   type tt
>     integer :: n
>   end type tt

> contains
> !==========================
> subroutine test_sub_1(z,t)
> implicit none

> real :: z(t%n)
> type (tt) :: t

> end subroutine test_sub_1
> !==========================
> end module test_module

--
Craig Dedo
17130 W. Burleigh Place
P. O. Box 423
Brookfield, WI   53008-0423
Voice:  (262) 783-5869
Fax:    (262) 783-5928
Mobile: (414) 412-5869
E-mail: <cd...@wi.rr.com> or <cr...@ctdedo.com>

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.