a cute program
  Home FAQ Contact Sign in
comp.lang.fortran only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.fortran Profile…
 Up
a cute program         


Author: robert.corbett
Date: Apr 17, 2008 22:45

Consider the program

SUBROUTINE SQRT
PRINT *, 10
END

PROGRAM MAIN
CALL SQRT
END

This program is standard conforming.

Bob Corbett
10 Comments
Re: a cute program         


Author: bru
Date: Apr 18, 2008 00:33

> Consider the program
>
> SUBROUTINE SQRT
> PRINT *, 10
> END
>
> PROGRAM MAIN
> CALL SQRT
> END
>
> This program is standard conforming.
>
> Bob Corbett

Why 10 instead of '10' works?

B Bru
no comments
Re: a cute program         


Author: nospam
Date: Apr 18, 2008 00:44

bru wrote:
>> Consider the program
>>
>> SUBROUTINE SQRT
>> PRINT *, 10
>> END
>>
>> PROGRAM MAIN
>> CALL SQRT
>> END
>>
>> This program is standard conforming.
>>
>> Bob Corbett
>
> Why 10 instead of '10' works?

Either would work fine, but that's clearly unrelated to Bob's point.
Show full article (0.85Kb)
no comments
Re: a cute program         


Author: glen herrmannsfeldt
Date: Apr 18, 2008 16:36

Richard Maine wrote:
(snip)
>>> PRINT *, 10
(snip)
>>Why 10 instead of '10' works?
> Either would work fine, but that's clearly unrelated to Bob's point.
> See the syntax of the PRINT statement in any Fortran text. The 10 here
> is the output list. Lots of things are allowed in an output list, with
> 10 and '10' both being simple examples of literal constants (which in
> turn are simple cases of expressions).

PRINT was in Fortran I and Fortran II. It was in Fortran IV for back
compatibility. (Format statement number required.) It seems not to
be in Fortran 66, which otherwise is fairly close to Fortran IV.

However, until Fortran 77 constants were not allowed in I/O lists.
This would sometimes result in variables that never changed,
but were only for use in output statements.

-- glen
no comments
Re: a cute program         


Author: robert.corbett
Date: Apr 18, 2008 18:31

On Apr 18, 12:33 am, bru wrote:
> robert.corb...@sun.com wrote:
>> Consider the program
>
>> SUBROUTINE SQRT
>> PRINT *, 10
>> END
>
>> PROGRAM MAIN
>> CALL SQRT
>> END
>
>> This program is standard conforming.
>
>> Bob Corbett
>
> Why 10 instead of '10' works?

It's shorter.

Bob Corbett
no comments
Re: a cute program         


Author: nospam
Date: Apr 18, 2008 20:18

glen herrmannsfeldt ugcs.caltech.edu> wrote:
> PRINT was in Fortran I and Fortran II. It was in Fortran IV for back
> compatibility. (Format statement number required.) It seems not to
> be in Fortran 66, which otherwise is fairly close to Fortran IV.

Odd. I hadn't recalled that. I went to find the citation in f66 to show
that it was there... but not only could I not find it, I did find
mention in the appendix about its removal (the removal of PRINT - not of
an appendix :-)). The appendix doesn't specifically say PRINT, but the
general description pretty clearly is referring to PRINT, among others.
The appendix mentions removing forms that are specific to particular
units and making the I/O more consistent across units. Seems like f77
(which reintroduced PRINT) was a step backwards in such consistency.

You just made me drag out my f77 standard to check that. I was *SURE*
that PRINT was in f77, but I've been wrong before about things I was
sure of, and you have me wondering on this one. Yep, PRINT is there -
but only in the full language - not in the subset.
Show full article (1.28Kb)
no comments
Re: a cute program         


Author: Gerry Ford
Date: Apr 20, 2008 00:05

<robert.corbett@sun.com> wrote in message
news:df35062a-3d4b-4a85-ad4a-ac00159e92d0@q1g2000prf.googlegroups.com...
> On Apr 18, 12:33 am, bru wrote:
>> robert.corb...@sun.com wrote:
>>> Consider the program
>>
>>> SUBROUTINE SQRT
>>> PRINT *, 10
>>> END
>>
>>> PROGRAM MAIN
>>> CALL SQRT
>>> END
>>
>>> This program is standard conforming.
>>
>>> Bob Corbett
>>
>> Why 10 instead of '10' works?
> ...
Show full article (0.90Kb)
no comments
Re: a cute program         


Author: glen herrmannsfeldt
Date: Apr 20, 2008 02:20

Gerry Ford wrote:
(snip)
>>>> PRINT *, 10
(snip)
> I don't know how 10 isn't a lun like any other.
> The output is 10 on my machine.

All the way to Fortran I it was PRINT fmt, list
with fmt the number of a FORMAT statement. Interestingly, this
statement disappeared in Fortran 66, only to appear again in
Fortran 77, along with list directed I/O. The Fortran I form
of the READ statement was also added back in Fortran 77.

The other formatted I/O statements from Fortran I,
PUNCH, READ INPUT TAPE, and WRITE OUTPUT TAPE,
are gone forever from the standard.

(Who had the idea of short identifiers and long statement names,
such as WRITE OUTPUT TAPE and DOUBLE PRECISION.)

-- glen
no comments
Re: a cute program         


Author: nospam
Date: Apr 20, 2008 09:05

Gerry Ford wrote:
> <robert.corbett@sun.com> wrote in message
> news:df35062a-3d4b-4a85-ad4a-ac00159e92d0@q1g2000prf.googlegroups.com...
>>>> PRINT *, 10
> I don't know how 10 isn't a lun like any other.

As in my reply to bru, see any Fortran text for the syntax of the PRINT
statement. Usenet is not a substitute for a Fortran text. While we can
help explain confusions, usenet alone is not actually a good way to
learn the language from scratch. It does actually require at least some
resource elsewhere also. The PRINT statement doesn't have a lun in it
anywhere.

--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
no comments
Re: a cute program         


Author: Gerry Ford
Date: Apr 20, 2008 22:59

"Richard Maine" wrote in message
news:1ifouc2.3t5l4klmm8qkN%%nospam@see.signature...
> Gerry Ford wrote:
>
>> <robert.corbett@sun.com> wrote in message
>> news:df35062a-3d4b-4a85-ad4a-ac00159e92d0@q1g2000prf.googlegroups.com...
>
>>>>> PRINT *, 10
>
>> I don't know how 10 isn't a lun like any other.
>
> As in my reply to bru, see any Fortran text for the syntax of the PRINT
> statement. Usenet is not a substitute for a Fortran text. While we can
> help explain confusions, usenet alone is not actually a good way to
> learn the language from scratch. It does actually require at least some
> resource elsewhere also. The PRINT statement doesn't have a lun in it
> anywhere.
Show full article (1.49Kb)
no comments

RELATED THREADS
SubjectArticles qty Group
2008/04/16 new programs and new trading programs addedalt.cracks ·
1 2