Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any HASHDICT_VALUE_TYPE #3

Open
senyai opened this issue Jun 30, 2021 · 2 comments
Open

Any HASHDICT_VALUE_TYPE #3

senyai opened this issue Jun 30, 2021 · 2 comments

Comments

@senyai
Copy link

senyai commented Jun 30, 2021

Hi!

The documentations says the value type is defined as int in the header file, you can redefine it to the required type, which could be char or void* or anything you need., but

node->value = -1;
assigns -1 to that value and you can't assing -1 to a void *, don't you?

@exebook
Copy link
Owner

exebook commented Nov 30, 2021

@senyai I think -1 will work for void* because I do not think that could possibly be a valid pointer in either 32 or 64 bit addressing systems, but you're right something have to be done about this magic number, maybe we could introduce a constant.

@forcegk
Copy link

forcegk commented Dec 13, 2023

I support this feature request, as it will not work for types like structs (kinda weird as you should use a pointer) but for UNIONS there is some problems, as you need to access a "field" (or interpretation of data). Maybe something in the lines of

#define HASHDICT_DEFAULT_ASSIGNMENT_OPERATION node->value.f64 = 0.

Thank you for the great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants