[comp.bugs.sys5] System V tsearch snafu

gwyn@smoke.BRL.MIL (Doug Gwyn ) (01/23/89)

The description in the SVR3.0 PRM for the "rootp" etc. pointer types,
and the library source code, for tsearch(3C) and related functions is
all bollixed up.  This is also specified wrong in the SVID.

"root" should be of generic pointer type (char * or void *), and the
implementation of tsearch() etc. should coerce this into NODE * for
internal use.  There is no way for the application to specify NODE *
as the current implementation would technically require.

The reason these routines happen to have worked is that on most systems
AT&T "supports", all pointers have the same representation.  This is
definitely not true of all systems in existence, however, so the types
should be gotten correct.

The only pointer representation equivalence required by the proposed
ANSI C standard is between void * and char *, not NODE *.

gwyn@smoke.BRL.MIL (Doug Gwyn ) (01/23/89)

In article <9481@smoke.BRL.MIL>, gwyn@smoke.BRL.MIL (Doug Gwyn ) writes:
> The description in the SVR3.0 PRM for the "rootp" etc. pointer types,
> and the library source code, for tsearch(3C) and related functions is
> all bollixed up.  This is also specified wrong in the SVID.

I'm told that this is fixed in SVID Issue 3.

Meanwhile, I've noticed that the return type from these functions
is a NODE *, where NODE is a completely undocumented internal type.
It really ought to have been the "key" member of the NODE, as indicated
by the documentation.

I think I've figured out why we didn't try to include these in the
ANSI C Standard.