C container and persistent library ?

L

llothar

Hello,

i have a few program parts that need a downgrade from C++ to C.

I looked at it and while emulating the class system manually is not
that hard, i really miss my templates and container types. Is there
any any library for c that has generic (aka void* pointer)
hashtables, linked lists and maybe btree's ? If there is a way to read/
write such containers to disk it would be perfect.

Google didn't found anything but i can't believe that all you are
rewritting this code all the time.
 
U

user923005

Hello,

i have a few program parts that need a downgrade from C++ to C.

I looked at it and while emulating the class system manually is not
that hard, i really miss my templates and container types. Is there
any any library for c that has generic (aka void* pointer)
hashtables, linked lists and maybe btree's ? If there is a way to read/
write such containers to disk it would be perfect.

Google didn't found anything but i can't believe that all you are
rewritting this code all the time.

I like these:
http://eternallyconfuzzled.com/jsw_home.aspx

This is always an easy bet:
http://sourceforge.net/search/index.php

Wiki almost always has code links:
http://en.wikipedia.org/wiki/Hash_table
http://en.wikipedia.org/wiki/Linked_list
http://en.wikipedia.org/wiki/Btree

Or google:
http://www.google.com/search?source...G:2005-27,GGLG:en&q=hash+table+algorithm+code

or whatever. It doesn't take much moxie to find this stuff.
 
B

bluejack

It doesn't take much moxie to find this stuff.

But finding it does take the fun out of writing it
yourself, which is what C is all about. Can you
really call yourself a C programmer if you haven't
implemented a generic self-serializing hashtable?

-bluejack
 
Y

Yevgen Muntyan

bluejack said:
But finding it does take the fun out of writing it
yourself, which is what C is all about. Can you
really call yourself a C programmer if you haven't
implemented a generic self-serializing hashtable?

Rather you can call yourself a *good* programmer if you
have implemented a *good* hash table.
 
C

CBFalconer

llothar said:
i have a few program parts that need a downgrade from C++ to C.

I looked at it and while emulating the class system manually is not
that hard, i really miss my templates and container types. Is there
any any library for c that has generic (aka void* pointer)
hashtables, linked lists and maybe btree's ? If there is a way to
read/write such containers to disk it would be perfect.

Google didn't found anything but i can't believe that all you are
rewritting this code all the time.

You mean you didn't enter a suitable search. As far as hashtables
are concerned, see hashlib.zip, found at:

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

which puts virtually no restrictions on the type of data stored.
Licensed under GPL, unless you negotiate another license.

For btrees etc. look for Ben Pfaff.
 
M

Mark McIntyre

Hello,

i have a few program parts that need a downgrade from C++ to C.

You mean it needs to be ported to a platform that doesn't support C...
(you wont win friends here by implying that C is an inferior cousin to
C++)
I looked at it and while emulating the class system manually is not
that hard, i really miss my templates and container types. Is there
any any library for c that has generic (aka void* pointer)
hashtables, linked lists and maybe btree's ? If there is a way to read/
write such containers to disk it would be perfect.

C++ which relies extemsively on templates and the STL is going to be
hard to port. I would suggest that you determine the algo you need to
implement, and rewrite it.
Google didn't found anything but i can't believe that all you are
rewritting this code all the time.

Porting from C++ to C is probably pretty rare.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
L

llothar

You mean it needs to be ported to a platform that doesn't support C...
(you wont win friends here by implying that C is an inferior cousin to
C++)

Exactly i want to port to HPUX but don't want to send the huge cheque
to HP for there C++
compiler. It's not the topic of this posting - but i see it as a
downgrade - yes.

And because it is a system extension for the ruby scripting language
it is more natural to use only C.
Porting from C++ to C is probably pretty rare.

If you enter "C container library" or something like this you see that
google makes no difference between C++ and C. I only found C++
references, thats why i asked.
 
F

Flash Gordon

llothar wrote, On 03/03/07 17:18:
Exactly i want to port to HPUX but don't want to send the huge cheque
to HP for there C++

<OT>
Try gcc then.
</OT>

If you enter "C container library" or something like this you see that
google makes no difference between C++ and C. I only found C++
references, thats why i asked.

Generally the best way to implement things of significant complexity in
C is not the same as in C++, so if you have to do it in C you are better
off looking at the problem fresh to see what the best way of
implementing it in C is.
 
K

Keith Thompson

Yevgen Muntyan said:
Rather you can call yourself a *good* programmer if you
have implemented a *good* hash table.

And you can call yourself a *smart* programmer if you can find and use
a good hash table that somebody else has already written.

That's assuming your goal is to get the program working. If your goal
is to learn how to implement a good hash table, then of course
implementing it yourself is the only smart way to go.
 
K

Keith Thompson

llothar said:
Exactly i want to port to HPUX but don't want to send the huge cheque
to HP for there C++
compiler. It's not the topic of this posting - but i see it as a
downgrade - yes.

<OT>
gcc is free, it supports both C and C++, and it should work on HPUX.
</OT>
 
L

llothar

gcc is free, it supports both C and C++, and it should work on HPUX.
</OT>

The ruby interpreter comes compiled with HP C compiler, don't want to
run into problems linking HP and GCC executables.
And much more important gcc is generating very slow code, that hurts
on this old PA-RISC machines.
 
R

Richard Heathfield

Ian Collins said:
<OT>then use gcc and its "their"</OT>

If you're going to flame someone else's grammar, at least get your own
grammar right. It's "it's", not "its". "Its X" means "the X belonging
to it", whereas "it's X" is a contraction of "it is X" or "it has X".
You are also missing a comma.
 
M

Mark McIntyre

Exactly i want to port to HPUX but don't want to send the huge cheque
to HP for there C++

why not install a free one?
compiler. It's not the topic of this posting - but i see it as a
downgrade - yes.

then you're likely to find little sympathy in Comp.lang.c.

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
I

Ian Collins

Richard said:
Ian Collins said:




If you're going to flame someone else's grammar, at least get your own
grammar right. It's "it's", not "its". "Its X" means "the X belonging
to it", whereas "it's X" is a contraction of "it is X" or "it has X".
You are also missing a comma.
It wasn't a flame, I was correcting a word, not the grammar. My intent
was to help the OP with a common English mistake, not flame.

When I was at school, we were told never to precede and with a comma.
 
M

Mark McIntyre

The ruby interpreter comes compiled with HP C compiler, don't want to
run into problems linking HP and GCC executables.

Shouldn't be any. This is still your best bet, and you should probably
ask in a gcc group for more info,
And much more important gcc is generating very slow code, that hurts
on this old PA-RISC machines.

Same comment.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
C

CBFalconer

Ian said:
<OT>then use gcc and its "their"</OT>

I suspect llothar is not a native English speaker, and is doing
pretty well with the language. The crying shame is the native
speakers who can't use grammar and can't spell.

GCC is probably better than HPUX anyhow. Just guessing, no
experience with HPUX.
 
C

CBFalconer

Richard said:
Ian Collins said:
.... snip ...

If you're going to flame someone else's grammar, at least get your
own grammar right. It's "it's", not "its". "Its X" means "the X
belonging to it", whereas "it's X" is a contraction of "it is X"
or "it has X". You are also missing a comma.

I think there is a strong correlation (among native English
speakers) between correct grammar/spelling, and programming
ability.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top