Query about <dirent.h>

Doug Gwyn gwyn at BRL.MIL
Thu Nov 23 08:28:00 AEST 1989


From: gwyn at BRL.MIL (Doug Gwyn)

In article <437 at longway.TIC.COM> Andy Tanenbaum <uunet!cs.vu.nl!ast> writes:
>Now the question arises about what size to use there.  One possibility is
>	d_name[NAME_MAX+1]
>However, doing this means that <limits.h> must be included.

You, the implementer, could manually replace that NAME_MAX with the
appropriate value (perhaps found by inspecting <limits.h>).  This is
the same issue as occurs when declaring v*printf() in <stdio.h>; the
related header need not (nay, MUST not) be included, but a compatible
type (or value in the NAME_MAX case) must be used.

>What's an implementer to do?

What I did in my implementation was to cheat:
	char	d_name[1];
We were careful to word the IEEE Std 1003.1 specification so that
this is explicitly allowed.

Volume-Number: Volume 17, Number 66



More information about the Comp.std.unix mailing list