Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Is 'read(unit=2, 100)' valid fortran 2003/2008?

4 views
Skip to first unread message

dominiq

unread,
Oct 13, 2009, 12:48:34 PM10/13/09
to
read(unit=2, 100) is invalid under f95 because of:

Constraint: If the optional characters FMT= are omitted from the
format specifier, the format specifier shall be the second item in the
control information list and the first item shall be the unit
specifier without the optional characters UNIT=.

The wording in the f2003/2008 drafts I have at hand is more ambiguous:

R913 io-control-spec is [ UNIT = ] io-unit
or [ FMT = ] format
or [ NML = ] namelist-group-name
(long list of other arguments with required keyword specifier)

C910 (R913) An io-unit shall be specified; if the optional characters
UNIT=
are omitted, the io-unit shall be the first item in the
io-control-spec-list.
C917 (R913) If format appears without a preceding FMT=, it shall be
the
second item in the io-control-spec-list and the first item
shall
be io-unit.
C918 (R913) If namelist-group-name appears without a preceding NML=,
it shall
be the second item in the io-control-spec-list and the
first item
shall be io-unit.

R901 io-unit is file-unit-number
or *
or internal-file-variable

Does a io-unit in C917 includes the optional characters UNIT=? If yes,
is it correct to understand that read(unit=2, 100) is allowed in
f2003/2008?

TIA

Dominique

Richard Maine

unread,
Oct 13, 2009, 1:08:31 PM10/13/09
to
dominiq <dom...@lps.ens.fr> wrote:

> read(unit=2, 100) is invalid under f95 because of:
>

> Constraint:... [elided]

> The wording in the f2003/2008 drafts I have at hand is more ambiguous:

I'd disagree. I'd say it was more concise and precise in that it uses
bnf terms instead of repeating them as textual descriptions.
...


> C917 (R913) If format appears without a preceding FMT=, it shall be
> the
> second item in the io-control-spec-list and the first item
> shall
> be io-unit.

...


> R901 io-unit is file-unit-number
> or *
> or internal-file-variable
>
> Does a io-unit in C917 includes the optional characters UNIT=? If yes,
> is it correct to understand that read(unit=2, 100) is allowed in
> f2003/2008?

No. You have misinterpreted this as illustrated by the extra word you
added. It is a very small extra word, but an important one. C917 refers
to "io-unit". It does not refer to "a io-unit". Note also that io-unit
is italicized. (This doesn't show up if you have only a plain text copy,
but the actual standard is not plain text).

The italicized io-unit is a bnf term. You cited the definition (R901).
That definition does not include UNIT=. The thing that includes an
optional UNIT= is the UNIT= specifier. "Io-unit" is not a sloppy
abbreviation for "the UNIT= specifier", which is how it looks like you
are interpreting it.

When the standard uses an bnf term, it means it literally - that exact
syntax. The fact that a UNIT= specifier can have the form io-unit does
not imply that "io-unit" is a synonym for the UNIT= specifier.

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain

dominiq

unread,
Oct 13, 2009, 1:23:14 PM10/13/09
to
On 13 oct, 19:08, nos...@see.signature (Richard Maine) wrote:

> dominiq <domi...@lps.ens.fr> wrote:
> > read(unit=2, 100) is invalid under f95 because of:
>
> > Constraint:... [elided]
> > The wording in the f2003/2008 drafts I have at hand is more ambiguous:
>
> I'd disagree. I'd say it was more concise and precise in that it uses
> bnf terms instead of repeating them as textual descriptions.
> ...

Richard,

Thanks for the answer. Note that I am not a native English speaker.
Although the use of articles is quite similar between English and
French, now and then I may miss some subtleties, then I prefer the f95
wording.

BTW what bnf stands for?

Dominique

nm...@cam.ac.uk

unread,
Oct 13, 2009, 1:25:36 PM10/13/09
to
In article <dacfd8f1-229b-405f...@k4g2000yqb.googlegroups.com>,

dominiq <dom...@lps.ens.fr> wrote:
>
>BTW what bnf stands for?

Backus-Naur Form. Wikipedia's explanation is as good as any.


Regards,
Nick Maclaren.

Richard Maine

unread,
Oct 13, 2009, 1:38:47 PM10/13/09
to
dominiq <dom...@lps.ens.fr> wrote:

> Thanks for the answer. Note that I am not a native English speaker.
> Although the use of articles is quite similar between English and
> French, now and then I may miss some subtleties, then I prefer the f95
> wording.

I understand and had not intended my explanation to be critical of you.
Reading standard-speak can be tricky, even for experts (sometimes even
for ones on the standards committee).

> BTW what bnf stands for?

As Nick notes, Backus-Naur form. For the exact variant used in the
Fortran standard, see 1.72 in the F2003:

"These syntax rules are expresed in a variation of Backus-Naur form
(BNF) in which..."

Basically, it is all of those Rxxx things in the standard.

glen herrmannsfeldt

unread,
Oct 13, 2009, 2:03:13 PM10/13/09
to
dominiq <dom...@lps.ens.fr> wrote:
(snip)


> BTW what bnf stands for?

http://en.wikipedia.org/wiki/Backus%E2%80%93Naur_Form

-- glen

0 new messages