RE: [sv-bc] Problem with $ferror in 1364 standard

From: Steven Sharp <sharp_at_.....>
Date: Mon Mar 20 2006 - 15:49:33 PST
>From: "Warmke, Doug" <doug_warmke@mentor.com>

>We also favor interpretation #4.

Thanks for responding.  So far everyone seems to agree with this basic
view.

>A bit more clarification:
>We propose that the status of the most recent $fopen,
>whether success or failure, shall be returned if a
>null fd is passed to $ferror.  That seems most intuitive
>and useful.

You could argue that it should only be the most recent failed
$fopen.  When you pass in the fd, you are trying to distinguish
which file you want the error for.  If the last $fopen didn't
return a 0 fd, then passing in a 0 fd indicates that you aren't
asking about that operation.  You are asking about one related
to a 0 fd, which must have been a failed $fopen.  This seems
more intuitive to me.

Admittedly, this isn't really more useful.  You can't distinguish
the 0 fd returned by two different $fopen calls.  So if you want
to know why $fopen failed, you need to call $ferror before you try
another $fopen anyway.  Otherwise, if the second $fopen fails, you
will lose the reason for the first failing.  It doesn't really help
your code to know that you can retrieve the cause of the earlier
$fopen failure, but only if the second $fopen happens to work.

I agree that the details of this should be more clearly specified.

>P.S.  For some reason this dialogue isn't reaching my Inbox,
>      although I see it on the email archives.  Other SV-BC
>      dialogues are coming through just fine.

That may be because I tried to include the old BTF mailing list
in the recipients.  I figured that someone there might remember
something about the intent, and might not be on the SV-BC list.
Apparently the list is no longer valid.  That may have affected
your mail router.  Sorry about that.

Steven Sharp
sharp@cadence.com
Received on Mon Mar 20 15:49:37 2006

This archive was generated by hypermail 2.1.8 : Mon Mar 20 2006 - 15:49:43 PST