Error handling in a size_t hashfunction For school I have a big assignment on hashtables etc. One of the functions is a size_t function where we calculate the hash value. (Keep in mind the structure of every function is given so we are not allowed to change input variables/function types). However, the hash calculator function does need to handle errors, but I am stuck on what value to return when encountering errors. In my head: all positive numbers are also possible hash values, and all negative numbers can not be returned in a size_t function. 

Thanks in advance
I have never seen anyone doing error handling in the calculation of a hash function. 

For a hash table to work, items must be equatable and hashable. If they are not equatable then sorry, you lost. As long as you can detect that an item is “bad” for equatability, you can just make it compare different to any item other than itself. And make it produce a hash code if constant zero or any other constant. 

If you have problems calculating a hash function then you have a bigger problem that you need to solve first.