A
Alan Balmer
Then, that implementation is arguably broken. The specification of the
FILENAME_MAX macro is quite clear:
FILENAME_MAX
which expands to an integer constant expression that is the size
needed for an array of char large enough to hold the longest
file name string that the implementation guarantees can be opened;
222)
____________________
222) If the implementation imposes no practical limit on the
length of file name strings, the value of FILENAME_MAX
should instead be the recommended size of an array intended
to hold a file name string. Of course, file name string
contents are subject to other system-specific constraints;
therefore all possible strings of length FILENAME_MAX cannot
be expected to be opened successfully.
Yes, it is quite clear, but HP-UX's value is correct, not "broken."
Here's a statement from Dennis Handly at HP:
"The manifest constant FILENAME_MAX is correctly defined in HP-UX. It
represents the largest value that an application can use and still be
guaranteed it will not cause an error return no matter upon which
HP-UX filesystem the application is attempting to open the file. This
is one of those peculiar maximum-minimum constants defined in the
standards. It is a minimum value which defines a maximum limit that an
application can use under all circumstances."
Note that HP-UX supports some rather old filesystems. On systems which
support POSIX, there are POSIX standards regarding both file name
length and path length. In general, though, the best *guarantee* that
can be made is 14.
Note that the C standard is blind to the concept of path, therefore
the path is implicitly part of the file name.
No. The C standard is blind to the concept of directory structure,
therefore the implication is that files are always opened in the
current directory. No paths are needed.