jacob navia wrote On 09/24/07 07:04,:
The C standard could use the same interface, and in system
where the error makes no sense, it would be just ignored!
What happens on a system where fopen() can fail for
reasons POSIX doesn't enumerate? I have used a system
where a file specification could (optionally) include an
account name and password; the attempt to open could fail
because of bad credentials. You might, with a stretch,
translate this to POSIX' EACCESS, but that's really not
how EACCESS is described.
File specifications on that same system could also
include network node names, and an open could fail because
of networking issues, permanent or transient. POSIX defines
errno values that describe network problems, but I don't
see any of them among the list that fopen() is allowed to
produce. So, what errno code should be delivered if a
network problem disrupts the open?
Still on the same system: An open could fail because
of invalid combinations of things like "record formats"
(specified in the second argument). Since POSIX has no
notion of "record format," POSIX defines no error codes
to describe problems with them; what code ought fopen()
to produce for this kind of failure?
What POSIX error code corresponds to picking "Cancel"
on the "Retry, Cancel, Abort?" dialog?
All those errors are just #defines that would take no
implementation effort and only be used in the systems
where those errors are supported.
If you try to enumerate all the possible reasons fopen()
could fail on all possible systems, you will find yourself
writing a very large number of #define's ... Also, the
resulting set will probably contain ambiguities.
POSIX is an adequate description of a certain class of
systems. It is not a description of all systems where C
runs, nor does it describe a superset of those systems.
Some systems just don't fall fully in the POSIX shadow.