You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please append additional macros for standard INT/UINT types
The text was updated successfully, but these errors were encountered:
depler
changed the title
Consider adding more HASH_FIND_XX for standard types
Consider adding more HASH_FIND_XX for standard INT/UINT types
Apr 11, 2021
I'm not inclined to add HASH_FIND_SHORT, HASH_FIND_UINT32_T, etc. etc.; that doesn't seem worth it, since someone who knows about this problem will simply use the general-purpose HASH_FIND in the first place. But it's pretty awful that HASH_FIND_INT(head, &uid, item) compiles silently to the wrong behavior!
We could mitigate this by changing the macro as follows:
This says "If the user gave us a pointer of the form &uid but sizeof(*&uid) isn't the same as sizeof(int), then compile-time fail."
I think the problem with this would be backward compatibility. Today, this works:
I was breaking my head why this code not working as expected:
Until I did this:
Please append additional macros for standard INT/UINT types
The text was updated successfully, but these errors were encountered: