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

strings don't really work #4

Open
rhulha opened this issue Sep 9, 2015 · 1 comment
Open

strings don't really work #4

rhulha opened this issue Sep 9, 2015 · 1 comment

Comments

@rhulha
Copy link

rhulha commented Sep 9, 2015

I found this out much too late...

int main(int argc, char* argv[])
{
    char *foo = "foo";
    char *missing = "missing";
    hashset_t set = hashset_create();

    if (set == NULL) {
        fprintf(stderr, "failed to create hashset instance\n");
        abort();
    }

    hashset_add(set, foo);
    printf("%d\n", hashset_is_member(set, foo));
    printf("%d\n", hashset_is_member(set, _strdup(foo));
}

This will print
1
0

@elfprince13
Copy link

The red flag here should have been that you weren't asked to provide your own hash function. That means it can only possibly be hashing the pointer.

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

2 participants