I want to use Perl hash in my C code (XS) as a set, so I only need to keep keys in hash. Is it possible to store something like null or another constant value to avoid creating unnecessary value?
Something like this:
int add_value(HV *hash, SV *value)
{
// just an example of key
char key[64];
sprintf(key, "%p", value);
if (hv_exists(hash, key, strlen(key)) return 0;
// here I need something instead of ?
return hv_stores(hash, key, ?) != NULL;
}
One of possible solution could be to store value itself, but maybe there is special constant for undef
or null.