For Programmers: Free Programming Magazines  


Home > Archive > Fortran > March 2004 > Err= (was something else)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Err= (was something else)
Richard Maine

2004-03-28, 12:00 am

(pli newsgroup snipped as usual)

"David Frank" <dave_frank@hotmail.com> writes:

> Yes indeed you can use ERR= to detect numeric conversion errors.


As usual, Dave neglected to mention that when he talks about Fortran,
he means his particular favorite compiler at the moment. All other
compilers don't count (at least until Dave switches, in which case
there is a new one and only one acceptable compiler).

In this particular case, most compilers do allow you to use err=
to detect numeric conversion errors, so Dave's comment is not
as compiler-specific as many of his are.

Just be aware, as I mentioned earlier, that

1) The standard does not guarantee this. It allows it, but
does not guarantee it.

2) Some compilers have extensions that will accept more forms
than the standard ones. Thus they might just "work" without
complaint (or err= handling) for input forms that would
surprise you. It depends on the circumstances whether you
regard this as a neat feature in accepting more inputs or
you think of it as a problem in allowing possible errors to
go undetected.

So if you want to be really sure about validating input forms,
you have to do it some other way.

That being said, I do use iostat= (which catches the same set
of things - just a different coding style preference) in my
own codes.

--
Richard Maine
email: my last name at domain
domain: sumertriangle dot net
Ron Shepard

2004-03-28, 12:00 am

In article <m2ekrexiak.fsf_-_@vega.dsl.att.net>,
Richard Maine <nospam@see.signature> wrote:

> Just be aware, as I mentioned earlier, that
>
> 1) The standard does not guarantee this. It allows it, but
> does not guarantee it.
>
> 2) Some compilers have extensions that will accept more forms
> than the standard ones. Thus they might just "work" without
> complaint (or err= handling) for input forms that would
> surprise you. It depends on the circumstances whether you
> regard this as a neat feature in accepting more inputs or
> you think of it as a problem in allowing possible errors to
> go undetected.
>
> So if you want to be really sure about validating input forms,
> you have to do it some other way.


My favorite example of strange integer input forms was a VAX Fortran
compiler in the early 80's. I forget now if it included both format
and list-directed read statements, but the compiler would accept the
letters "t" and "T" (and result in a value of -1), and "f" and "F"
(and result in a value of 0).

$.02 -Ron Shepard
Jan Vorbrüggen

2004-03-29, 7:34 am

> My favorite example of strange integer input forms was a VAX Fortran
> compiler in the early 80's. I forget now if it included both format
> and list-directed read statements, but the compiler would accept the
> letters "t" and "T" (and result in a value of -1), and "f" and "F"
> (and result in a value of 0).


Of course it would - those are the standard (for VMS, at least)
abbreviations for TRUE and FALSE, which map to 1 and 0.

Jan
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com