Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > C container and persistent library ?

Reply
Thread Tools

C container and persistent library ?

 
 
llothar
Guest
Posts: n/a
 
      03-02-2007
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.

 
Reply With Quote
 
 
 
 
Pierre Asselin
Guest
Posts: n/a
 
      03-03-2007
llothar <(E-Mail Removed)> wrote:
> [ ... ] 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.


You might try glib, http://www.gtk.org/api/2.6/glib/index.html .

--
pa at panix dot com
 
Reply With Quote
 
 
 
 
user923005
Guest
Posts: n/a
 
      03-03-2007
On Mar 2, 3:43 pm, "llothar" <(E-Mail Removed)> wrote:
> 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?sourcei...algorithm+code

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

 
Reply With Quote
 
bluejack
Guest
Posts: n/a
 
      03-03-2007
On Mar 2, 4:59 pm, "user923005" <(E-Mail Removed)> wrote:

> 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


 
Reply With Quote
 
Yevgen Muntyan
Guest
Posts: n/a
 
      03-03-2007
bluejack wrote:
> On Mar 2, 4:59 pm, "user923005" <(E-Mail Removed)> wrote:
>
>> 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?


Rather you can call yourself a *good* programmer if you
have implemented a *good* hash table.
 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      03-03-2007
llothar wrote:
>
> 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.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>


 
Reply With Quote
 
Martin Ambuhl
Guest
Posts: n/a
 
      03-03-2007
llothar wrote:
> Hello,
>
> i have a few program parts that need a downgrade from C++ to C.


You misspelled "upgrade". Try trolling elsewhere.

 
Reply With Quote
 
Mark McIntyre
Guest
Posts: n/a
 
      03-03-2007
On 2 Mar 2007 15:43:04 -0800, in comp.lang.c , "llothar"
<(E-Mail Removed)> wrote:

>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
 
Reply With Quote
 
llothar
Guest
Posts: n/a
 
      03-03-2007
> 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.

> >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.


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.

 
Reply With Quote
 
Flash Gordon
Guest
Posts: n/a
 
      03-03-2007
llothar wrote, On 03/03/07 17:18:
>> 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++


<OT>
Try gcc then.
</OT>

<snip>

>>> 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.

>
> 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.
--
Flash Gordon
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Persistent field and Persistent properties - difference gk Java 7 10-12-2010 09:43 PM
A container library in C Part 4. The arraylist container jacob navia C Programming 10 10-01-2009 02:26 PM
A container library in C: Part 3. List container implementation jacob navia C Programming 5 09-28-2009 08:19 PM
Concurrent, persistent background process for a J2EE container Arne Vajh°j Java 23 08-31-2008 02:15 AM
std::container::iterator vs std::container::pointer Vivi Orunitia C++ 11 02-04-2004 08:09 AM



Advertisments