iostat
Steve Kargl
sgk@troutmask.apl.washington.edu
Tue Aug 22 23:09:00 GMT 2006
On Tue, Aug 22, 2006 at 02:52:39PM -0700, Richard E Maine wrote:
> On Aug 22, 2006, at 1:35 PM, Steve Kargl wrote:
>
> >On Tue, Aug 22, 2006 at 10:07:10PM +0200, Daniel Franke wrote:
> >>
> >>If I am not completely mistaken, the numbers returned in "ierr"
> >>should be distinguishable?
> >
> >Yes, you are mistaken. Section 9.4.1.4i states...
> >...
> >You have case (2). Note, it does not say that unique positive
> >integers
> >must be assigned for different error conditions.
>
> Of course, it also doesn't say that they can't be. You are
> (correctly) noting that the standard doesn't require that the iostat
> values have to do anything useful about indicating the cause of the
> error. But the standard certainly allows it, and many (most?)
> compilers do so.
I knew you would fill in the blanks. :)
> I would personally agree with Daniel here that the numbers "should"
> be distinguishable.... for an appropriate sense of "should." In
> particular, that's for the sense of "I think it should be that way
> for user convenience" as opposed to the sense of being a requirement
> of the standard. The standard itself reserves the word "should" for
> its few recommendations as opposed to requirements. I use it in that
> same sense. I recommend this, but it isn't a requirement.
Unfortunately, gfortran runs on more than just a few operating
systems. While open(2) on many Unix-like system probably returns
ENOENT, EACCESS, etc., we would need to determine the corresponding
errors on all supported OS's. (FreeBSD's open(2) returns 21 unique
error codes where some of the error codes can mean more than one thing
depending on how open(2) is invoked) For example, MS Window does not have
the same level of file access permissions as Unix, but it does have
hidden files. So, gfortran would probably need a large message database.
I'd have to go read the C standard, but I'm willing to guess that the
value of EACCESS on one system can be different than EACCESS on another
system. gfortran can't simply do
i = open(...)
if (iostat) *iostat = i;
It would need something like (of course psuedocode below)
i = open(...)
if (iostat)
{
switch (i)
{
#if defined(EACCESS)
case EACCESS:
#else if defined(Cygwin's Equivalent error code)
case cygwin_code:
#else if define (darwin equivalent error code)
case darwin_code:
#endif
*iostat = 2;
break;
.... /* Ad nausem */
default: /* Catch all */
i = 1
}
--
Steve
More information about the Fortran
mailing list