Live data from Hacker News

Show HN: C library of generic, reference-counted data structures

theck01.github.io

11–20 of 42 posts

Re: Show HN: C library of generic, reference-counted data structures

#13
Hello. May I suggest looking for some code by tptacek for the red-black trees. I am looking too, but so far , I haven't been able to find it. I read about it first in this link: " rel="nofollow">https://news.ycombinator.com/item?id=4455225>.

I think your project looks very interesting. Reference counted datastructures is a great convenience.

Thanks, and Good Luck further.

Re: Show HN: C library of generic, reference-counted data structures

#14
Was there a rationale to choosing performActionOnStruct() names instead of the perhaps-more-idiomatic struct_perform_action() style?

I strongly advise against putting identifiers like release() and getCString() in the global namespace, that's probably not the wisest idea if you plan to use libraries other than your own.

Re: Show HN: C library of generic, reference-counted data structures

#15
I was interested to know how this compares with existing C libraries, so I "ported" the prime number example program to use GMP and GLib instead. It's not quite working yet (see the description) and I have to run now, but here's the code--I think it's nearly complete and would be interesting to benchmark once done. https://gist.github.com/jzwinck/5787359

Re: Show HN: C library of generic, reference-counted data structures

#16
post #9

It's nice that you made these available. You might also want to look at queue.h from BSD (see http://fxr.watson.org/fxr/source/sys/queue.h ) and tree.h ( http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/sys/tree.h ), single-file "libraries" that can generate a few different kinds of linked list and binary tree. These don't require typecasting at all, since they generate functions for your particular type. They are also…

[deleted]

Re: Show HN: C library of generic, reference-counted data structures

#17

nice. it's heartwarming to see things like this in c. in my spare time i am working on struct-sql mapping. it sometimes feels like the popular c libraries don't try hard enough to provide the convenience we get in other languages. with a little imagination (as here) i think we can push things a little further...

What is struct? Or do you mean the C struct type SQL? Like an ORM for C?

Re: Show HN: C library of generic, reference-counted data structures

#18
I've been meaning to refresh and expand both my algorithms knowledge and my C programming with a project like this, myself (as an application developer I find I've barely used either since graduating from university). Was that part of your goal at all?

I think this is pretty cool. I like the presence of the tests as well.

Re: Show HN: C library of generic, reference-counted data structures

#19
post #9

It's nice that you made these available. You might also want to look at queue.h from BSD (see http://fxr.watson.org/fxr/source/sys/queue.h ) and tree.h ( http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/sys/tree.h ), single-file "libraries" that can generate a few different kinds of linked list and binary tree. These don't require typecasting at all, since they generate functions for your particular type. They are also…

Should you ever need said macros, I've written a set: https://github.com/wrl/wwrl/blob/master/vector.h

Re: Show HN: C library of generic, reference-counted data structures

#20
post #9

It's nice that you made these available. You might also want to look at queue.h from BSD (see http://fxr.watson.org/fxr/source/sys/queue.h ) and tree.h ( http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/sys/tree.h ), single-file "libraries" that can generate a few different kinds of linked list and binary tree. These don't require typecasting at all, since they generate functions for your particular type. They are also…

> You might also want to look at queue.h from BSD

CPP macros, entirely. No, thanks.

Post reply on HN