473,320 Members | 1,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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
7 2616
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
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
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
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
"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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Brian Genisio | last post by:
Hello all, I need to use a hash table for quick lookup... What is the best way to do it? My current solution uses stl::map, where I essentially do the following (not compilable code): ...
4
by: Pelo GANDO | last post by:
Hi everybody ! I am a beginner in C++. I am looking for a (simple if it's possible) source code in C++ about hash table... Thank you ! Pelo
3
by: Zhiqiang Ye | last post by:
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...
113
by: Bonj | last post by:
I was in need of an encryption algorithm to the following requirements: 1) Must be capable of encrypting strings to a byte array, and decyrpting back again to the same string 2) Must have the same...
13
by: Sam Kong | last post by:
Hi, I am familiar with the ruby language. To use my ruby knowledge when writing in JavaScript, I use the following library. http://www.advogato.org/proj/Ruby.js/ If I include the file in...
3
by: jacobstr | last post by:
I've noticed Object.extend used in a few different ways and I'm having trouble distinguishing why certain usages apply to a given situation. On line 804 Ajax.Base is defined as follows: ...
2
by: cremoni | last post by:
STL has a hash function documented here: http://www.sgi.com/tech/stl/hash.html What header do I include? I can't find it defined anywhere in the MSVC headers. I'm using MSVC8, BTW. Sorry if...
5
by: abir | last post by:
Hi, I want a user defined key for tr1 unordered_map. My classes are, template<typename T> struct work{ int count; work(int count) : count(count){} }; template<typename W>
4
by: James Kanze | last post by:
On Jul 16, 10:53 pm, Mirco Wahab <wa...@chemie.uni-halle.dewrote: It depends. You might like to have a look at my "Hashing.hh" header (in the code at kanze.james.neuf.fr/code-en.html---the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.