By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,190 Members | 839 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,190 IT Pros & Developers. It's quick & easy.

Is there any good hash library in c/c++?

P: n/a
Hi,dear all,
I know there is a hash library in glibc, it's head file is search.h. One
can use hash map based on this.But its hash is global , there could be only
one hash structrue at one time. Is there good hash library to that I can use
it as a local data structure? Thanks a lot!

Zhiqiang Ye
Nov 14 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
In 'comp.lang.c', "Zhiqiang Ye" <ye**@mail.cbi.pku.edu.cn> wrote:

[The is no C/C++. There is C and there is C++. They are different languages.]
Hi,dear all,
I know there is a hash library in glibc, it's head file is search.h.
One
can use hash map based on this.But its hash is global , there could be
only one hash structrue at one time. Is there good hash library to that
I can use it as a local data structure? Thanks a lot!


http://users.footprints.net/~kaz/kazlib_doc/index.html

--
-ed- get my email here: http://marreduspam.com/ad672570
The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
C-reference: http://www.dinkumware.com/manuals/reader.aspx?lib=c99
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
Nov 14 '05 #2

P: n/a
Zhiqiang Ye wrote:

I know there is a hash library in glibc, it's head file is
search.h. One can use hash map based on this. But its hash is
global , there could be only one hash structrue at one time. Is
there good hash library to that I can use it as a local data
structure? Thanks a lot!


There is no such language as C/C++. You need to make up your
mind.

C++ can call code written in C. Whether the result will function
correctly is dependent on various facets of your system, and
off-topic here.

I have written a hash table library in purely portable standard
C. It is re-entrant, so can handle many structures with the same
code. It is available under the GPL licence, and other licences
may be negotiated should you not wish to release your own code.
See:

<http://cbfalconer.home.att.net/download/hashlib.zip>

--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Nov 14 '05 #3

P: n/a
Thank you very much.

[The is no C/C++. There is C and there is C++. They are different languages.]
Hi,dear all,
I know there is a hash library in glibc, it's head file is search.h.
One
can use hash map based on this.But its hash is global , there could be
only one hash structrue at one time. Is there good hash library to that
I can use it as a local data structure? Thanks a lot!


http://users.footprints.net/~kaz/kazlib_doc/index.html

--
-ed- get my email here: http://marreduspam.com/ad672570
The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
C-reference: http://www.dinkumware.com/manuals/reader.aspx?lib=c99
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/

Nov 14 '05 #4

P: n/a
Zhiqiang Ye wrote:

I know there is a hash library in glibc, it's head file is
search.h. One can use hash map based on this. But its hash is
global , there could be only one hash structrue at one time. Is
there good hash library to that I can use it as a local data
structure? Thanks a lot!
There is no such language as C/C++. You need to make up your
mind.

Thanks. Actually, I am just doing some scientific calculation, so I am not
so clear about programing. I often write c style code, mixed with some
c++ charateristics . :)


C++ can call code written in C. Whether the result will function
correctly is dependent on various facets of your system, and
off-topic here.

I have written a hash table library in purely portable standard
C. It is re-entrant, so can handle many structures with the same
code. It is available under the GPL licence, and other licences
may be negotiated should you not wish to release your own code.
I don't know the meaning of "reentrant" before, but now since you mentioned
this, I see.
Since the search.h in glibc, provides a reentrant function for hash table if
we #define _GNU_SOURCE, I can just use glibc. Is this right?
See:

<http://cbfalconer.home.att.net/download/hashlib.zip>

--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

Nov 14 '05 #5

P: n/a
"Zhiqiang Ye" <ye**@mail.cbi.pku.edu.cn> writes:
Since the search.h in glibc, provides a reentrant function for hash table if
we #define _GNU_SOURCE, I can just use glibc. Is this right?


You can use that if you don't mind that your code will only work
with glibc. But Chuck's library (if I recall correctly) is
portable, so you can use it regardless of the system C library.
--
int main(void){char p[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv wxyz.\
\n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int putchar(\
);while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof p-1;putchar(p[i]\
);}return 0;}
Nov 14 '05 #6

P: n/a
Zhiqiang Ye wrote:
.... snip ... Since the search.h in glibc, provides a reentrant function for
hash table if we #define _GNU_SOURCE, I can just use glibc.
Is this right?


No. There is no such routine in standard portable C. See the
welcome message to this group, which was recently reposted.

--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Nov 14 '05 #7

P: n/a
On Sun, 30 May 2004 18:31:45 +0800, Zhiqiang Ye wrote:
Hi,dear all,
I know there is a hash library in glibc, it's head file is search.h. One
can use hash map based on this.But its hash is global , there could be only
one hash structrue at one time. Is there good hash library to that I can use
it as a local data structure? Thanks a lot!

glibc has various _r (e.g. hsearc_r) which is not global.
It's probably not portable outside glibc systems though.

Nov 14 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.