JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for COMP-FORTRAN-90 Archives


COMP-FORTRAN-90 Archives

COMP-FORTRAN-90 Archives


COMP-FORTRAN-90@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

COMP-FORTRAN-90 Home

COMP-FORTRAN-90 Home

COMP-FORTRAN-90  2004

COMP-FORTRAN-90 2004

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: Is this program standard conforming (Fortran 95) ?

From:

Dick Hendrickson <[log in to unmask]>

Reply-To:

Fortran 90 List <[log in to unmask]>

Date:

Fri, 3 Sep 2004 15:42:36 -0500

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (150 lines)

James Giles wrote:
> Richard Maine wrote:
>
>>--On Friday, September 3, 2004 3:31 PM -0400 Jean Vezina
>><[log in to unmask]> wrote:
>>
>>
>>>What causes the problem is the string 5*abc
>>>
>>>Is it allowed to have a repeat count before
>>>an undelimited character string ?
>>
>>Yes.  You can't have something like 5* as part of an
>>undelimited character string (that's item 4 in the list
>>of things you can't have).  That restriction resolves
>>what would otherwise be a potential ambiguity.
>
>
> Since the 5* is not part of the undelimited string in this
> example, but is *intended* to be a repeat count, how does
> item 4 apply?

Because part (4) is the part that ensures that the 5*
is the repeat count, not part of the character constant.
Basically, there is no way to read in a character value
like 5*abc into a character string thing of length 5,
you need '5*abc'. The "5*" is always taken as a repeat count
if it is undelimited.  (Or maybe I don't understand your
comment?)

>
>
>>F2003 even has specific mention of the case of a repeat
>>count followed by an undelimitted character string, which makes
>>the answer pretty unambiguous.  That mention was to clear up
>>a more subtle point that came up in an interp.  Hmm, probably
>>an f95 interp, so I suspect that same mention is in one of the
>>f95 corrigenda, even though I don't see it in the original f95...
>>Yep, there it is.  It is in f95 corrigenda 2.
>
>
> For those of us with difficulty navigating the mysteries of the
> j3-fortran website, could you be more specific about the
> potential ambiguity?  I don't see the mention in the F2003
> document (unless it was added after the FDC).  Nor can
> I think of an ambiguous case.  (I suppose with 20 minutes of
> spare time I could track down f95 corrigenda 2, and hope
> it's written in normal English.)
>
The ambiguity is with trying to read things with different
types when there is a repeat count.  The interesting cases
are things like reading  2*(1.0, 0.0).  Is it 2 complex
values or 3 character values?  (The answer is, "Yes, either
is fine, depending on the read variables").  It's not
one complex and 2 characters, for example.

I put the interp below.  As you can see, it's written in
normal English ;) .

Dick Hendrickson
> --
> J. Giles
>
> "I conclude that there are two ways of constructing a software
> design: One way is to make it so simple that there are obviously
> no deficiencies and the other way is to make it so complicated
> that there are no obvious deficiencies."   --  C. A. R. Hoare
>
The full interp is here.


NUMBER: 000025
TITLE: List-directed input: types of variables corresponding to
        repeated values
KEYWORDS: List-directed input, repeated values
DEFECT TYPE: Erratum
STATUS: Included in corrigendum/complete

QUESTION:

When a repeat count is used in list-directed input, must all the
variables into which the repeated value is read have the
same type?
I see no reason in the standard to assume that restriction,
but at
least one Fortran 90 implementation assumes it.

ANSWER:

No, the variables are not required to be of the same type,
but the
type of the repeated constant is either a literal constant, or a
nondelimited character constant, but not both (10.8, "where
<c> is a
literal constant or a nondelimited character constant").
Whether
certain forms of a repeated constant are treated as a literal
constant or a nondelimited character constant is determined
by the
type of the first variable which consumes this value.
Indeed, how
many characters from the input record are part of <c> is
dependent on
the type of the first variable which consumes a value from that
<r*c>.

For example, the input
    2*(1.0, 0.0)
conforms to the standard when consumed by three list items
of type
character or by two list items of type complex.  If there
are three
character variables, the first two get the value "(1.0",
while the
third gets the value "0.0)".  If there are two complex
variables,
they both are assigned the value (1.0,0.0).

Similarly, the input
    2*.TRUE.
can be consumed by two logical variables, or two character
variables,
but not by one character and one logical variable.

An edit is provided to clarify the situation.

EDITS:

In section 10.8.1,  add the following as a new paragraph,
just before
Note 10.26 [175:33+].
   "For the <r*c> form of an input value, the constant <c> is
    interpreted as a nondelimited character constant if the
first list
    item corresponding to this value is of type default
character,
    there is a nonblank character immediately after <r*>,
and that
    character is not an apostrophe or a quotation mark;
otherwise, <c>
    is interpreted as a literal constant."

SUBMITTED BY: Robert Corbett

HISTORY: 98-155   m145 Submitted (part 3)
          WG5/N1410     Draft answer
          01-159r1 m156 Passed unanimously by J3 meeting
          01-224r1 m157 Passed by J3 letter ballot
          WG5/N1435 Passed by WG5 ballot

Top of Message | Previous Page | Permalink

JiscMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

December 2023
February 2023
November 2022
September 2022
February 2022
January 2022
June 2021
November 2020
September 2020
June 2020
May 2020
April 2020
December 2019
October 2019
September 2019
March 2019
February 2019
January 2019
November 2018
October 2018
September 2018
August 2018
July 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
December 2015
November 2015
October 2015
September 2015
August 2015
June 2015
April 2015
March 2015
January 2015
December 2014
November 2014
October 2014
August 2014
July 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
July 2013
June 2013
May 2013
April 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
August 2010
July 2010
June 2010
March 2010
February 2010
January 2010
December 2009
October 2009
August 2009
July 2009
June 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
January 2007
2006
2005
2004
2003
2002
2001
2000
1999
1998
1997


JiscMail is a Jisc service.

View our service policies at https://www.jiscmail.ac.uk/policyandsecurity/ and Jisc's privacy policy at https://www.jisc.ac.uk/website/privacy-notice

For help and support help@jisc.ac.uk

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager