The value set by Tcl_SetHashValue
(which is a macro, for historical reasons) is cast by the macro to be of type ClientData
. That in turn is a typedef for void *
(except on pre-C89 systems (!) where it is a char *
) and has the promise that Tcl will not poke its grubby fingers inside it; a subsequent Tcl_GetHashValue
will return exactly the value that you provided.
In your sample code, pEntry
will have a pointer to a valid structure or a NULL
if the criteria were not matched. If pEntry
is non-NULL
, pValue
will have the value placed in. Which might well be NULL
here; NULL
is a perfectly fine thing to put in, and it's up to your code to understand what that might possibly mean.
Later versions of Tcl are the same, but might have tinkered with exactly what the definitions are. And for sure we dropped pre-C89 support. (In fact, it turned out we did so for building Tcl itself in 8.4 by accident and not one user complained. We're conservative, but not that conservative!)