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

vector, hash table, etc. library in C? I am abandoning C++

P: n/a
Hello, I regret to say that C++ sucks big rocks.
I used it until recently because of its container libraries and for no
other reason.
In a nutshell concurrency, interruptions, exceptions are ingredients
which when mixed according to a C++ recipe produce a disaster.

Today I searched for a pure C implementations of vector, dictionary,
and other data structures on the net but the results contained so much
C++ noise that it's like looking for a needle in a haystack. Can
anybody please point me to such a true and tried C library?
Much obliged
--.
Markus Neuhaber

Apr 22 '06 #1
Share this Question
Share on Google+
12 Replies


P: n/a


mn*********@berlin.com wrote:
Hello, I regret to say that C++ sucks big rocks.
I used it until recently because of its container libraries and for no
other reason.
In a nutshell concurrency, interruptions, exceptions are ingredients
which when mixed according to a C++ recipe produce a disaster.

Today I searched for a pure C implementations of vector, dictionary,
and other data structures on the net but the results contained so much
C++ noise that it's like looking for a needle in a haystack. Can
anybody please point me to such a true and tried C library?
Much obliged
--.
Markus Neuhaber


I don't think the reasons you gave for abandoning C++ are valid. But
hey, its your choice. I tend to use both C and C++ - it depends pretty
much on what you're doing, how much of the language you're using you
know, and any legacy stuff or other restrictions that may be placed on you.

Have a look at this: http://softwaresensation.com/memsl/

I think it has all the containers you will need for most purposes :

# Single, Double, and Circular Linked Lists
# AVL Balanced and Threaded Binary Trees
# Dynamic Hashing Tables
# Stacks, Queues and Dequeues (using arrays or linked lists)
# Sets (Pascal implementation, with union, difference, intersection, etc.)
# Bags, Tables and Dictionaries
# Priority Heaps (uses the MemSL multi-dimensional array allocator)
# Priority Search Queue
It is a C library (C++ wrapper classes also available) - It has been in
use for more than 10yrs (so their docu says) and it is open source (you
may want to double check on the licensing if you're doing anything
commercial though - the docu has some pretty scary/terse legal
sections), although their website says its opensource...

Enjoy.

Apr 22 '06 #2

P: n/a

mn*********@berlin.com wrote:
Hello, I regret to say that C++ sucks big rocks.
I used it until recently because of its container libraries and for no
other reason.
In a nutshell concurrency, interruptions, exceptions are ingredients
which when mixed according to a C++ recipe produce a disaster.


Out of curiosity, can you please elaborate on some of the problems you
are having. In my firm, we use C++ to take advantage of concurrency,
and sometimes exceptions. While I don't program with interrupts, they
are certainly supported to varying degrees depending on your OS and
runtime implementation (the same is true of C).

Apr 22 '06 #3

P: n/a
On 22 Apr 2006 06:09:24 -0700, "mn*********@berlin.com"
<mn*********@berlin.com> wrote:
Hello, I regret to say that C++ sucks big rocks.
Sometimes yes, mostly no.
I used it until recently because of its container libraries and for no
other reason.
In a nutshell concurrency, interruptions, exceptions are ingredients
which when mixed according to a C++ recipe produce a disaster.
Today I searched for a pure C implementations of vector, dictionary,
and other data structures on the net but the results contained so much
C++ noise that it's like looking for a needle in a haystack. Can
anybody please point me to such a true and tried C library?


One 'tried' C library is GLib: http://www.gtk.org/api/
You may also try some 'untried' libraries like:
http://freshmeat.net/projects/libcfl/?topic_id=809
http://www.ioplex.com/~miallen/libmba/
http://libtc.sourceforge.net/

Disclaimer: Haven't used those libraries and cannot recommend them
therefore.

Good luck,
Roland Pibinger
Apr 22 '06 #4

P: n/a
REH

<mn*********@berlin.com> wrote in message
news:11*********************@g10g2000cwb.googlegro ups.com...
Hello, I regret to say that C++ sucks big rocks.
I used it until recently because of its container libraries and for no
other reason.
In a nutshell concurrency, interruptions, exceptions are ingredients
which when mixed according to a C++ recipe produce a disaster.

Today I searched for a pure C implementations of vector, dictionary,
and other data structures on the net but the results contained so much
C++ noise that it's like looking for a needle in a haystack. Can
anybody please point me to such a true and tried C library?
Much obliged
--.
Markus Neuhaber


You are most likely trolling, but I'll bite. I've been using C++ for years
to build real-time embedded systems and have never had any "disastrous"
problems involving any of the facilities you listed. For that matter, I've
also used Ada for years which has concurrency, interrupt handling, and
exceptions all built into the language without any issues. So, I guess the
problem must be you and not the combination of these features.

REH
Apr 22 '06 #5

P: n/a
Have you followed discussions on the pthread-c++ mailing list?
After reading them for some time would you feel comfortable writing
complex threaded programs in c++? I wouldn't.
pthreads are but 1 example, the same is true of the boost thread
facilities, etc...
I don't want to deal with this junk any more. I've wasted enough time
scratching my head how to achieve correctness.
It seems that for most of the c++ proponents here 50% correctness is
good enough.
Go right ahead - ship it!

Apr 22 '06 #6

P: n/a

mn*********@berlin.com wrote:
Have you followed discussions on the pthread-c++ mailing list?
After reading them for some time would you feel comfortable writing
complex threaded programs in c++? I wouldn't.
pthreads are but 1 example, the same is true of the boost thread
facilities, etc...
I don't want to deal with this junk any more. I've wasted enough time
scratching my head how to achieve correctness.
It seems that for most of the c++ proponents here 50% correctness is
good enough.
Go right ahead - ship it!


You just need to work with someone who knows what they are doing. Most
people don't know what they are doing, and I think most of the people
who do don't contribute to USENET. Even so, there's no magic involved
in solving these problems. Take concurrency, for example. Just putting
C++ wrappers around the implementatoins in Butenhof would get you most
of the way there.

Apr 22 '06 #7

P: n/a
My point exactly - they will get me most of the way but not ALL the
way.
In other words if the program stays up 95% of the time, that's great.
Just catch GPF's and restart program the remaining 5% of the time.
That's the c++ way.
Unless you can show I am mistaken there is no solution for the
challenges that interruptions present as of yet.
Good bye and I thank those who pointed me to C libraries including
glib, they look promising.

Apr 22 '06 #8

P: n/a
mn*********@berlin.com wrote :
Have you followed discussions on the pthread-c++ mailing list?
Why are you even using pthread in C++ ? It is well known that pthread
isn't suitable for C++. See
http://open-std.org/jtc1/sc22/wg21/d...2006/n1940.pdf

C++ has better alternatives for multithreading (like boost.thread, as
you mentioned - but that is still but an attempt to bring multithreading
to C++), and anyway multithreading is overrated : I've found it to be
mostly useless in C++, where you can simply write code asynchronously
within a single thread.

I don't want to deal with this junk any more. I've wasted enough time
scratching my head how to achieve correctness.


Please don't insult the language.
If you don't have enough skill to attain satisfying correctness in C++,
that's your problem.
A lot of people think C++ is pretty good. Yes, we know it's a little
tricky or even annoying sometimes, but it has some good counterparts.

Anyway I don't see how C is better.
It's way more annoying to me, as it's basically the same as C++ without
the abstraction possibilities.

For a container library in C I would advise glib as it is the only one I
ever used.
It may be a little big though, as it contains quite some stuff.
Apr 22 '06 #9

P: n/a

loufoque wrote:
mn*********@berlin.com wrote :
Have you followed discussions on the pthread-c++ mailing list?


Why are you even using pthread in C++ ? It is well known that pthread
isn't suitable for C++. See
http://open-std.org/jtc1/sc22/wg21/d...2006/n1940.pdf

C++ has better alternatives for multithreading (like boost.thread, as
you mentioned - but that is still but an attempt to bring multithreading
to C++), and anyway multithreading is overrated : I've found it to be
mostly useless in C++, where you can simply write code asynchronously
within a single thread.


This doesn't make any sense. You need multithreading if you want to do
parallel processing in the same executable. How can you achieve
parallel processing with one thread?

Apr 22 '06 #10

P: n/a
REH

<mn*********@berlin.com> wrote in message
news:11*********************@e56g2000cwe.googlegro ups.com...
Have you followed discussions on the pthread-c++ mailing list?
After reading them for some time would you feel comfortable writing
complex threaded programs in c++? I wouldn't.
pthreads are but 1 example, the same is true of the boost thread
facilities, etc...
I don't want to deal with this junk any more. I've wasted enough time
scratching my head how to achieve correctness.
It seems that for most of the c++ proponents here 50% correctness is
good enough.
Go right ahead - ship it!


You need to quote some text so we know to whom and what you are replying.

REH
Apr 22 '06 #11

P: n/a
REH

"loufoque" <lo******@remove.gmail.com> wrote in message
news:44**********************@news.free.fr...
mn*********@berlin.com wrote :

but that is still but an attempt to bring multithreading to C++), and
anyway multithreading is overrated : I've found it to be mostly useless in
C++, where you can simply write code asynchronously within a single
thread.

Such code is all but worthless in a real-time system with hard deadlines.
You really need truly independent, prioritized threads of execution. You
need to be able to deterministically guarantee a thread's time partition.

REH
Apr 22 '06 #12

P: n/a
mn*********@berlin.com wrote:
Hello, I regret to say that C++ sucks big rocks.


*plonk*

This way I won't see your whiny ass over on comp.lang.c, the place you
should have posted your request (but not the bashing).

I'm not the only C person who also reads this group, so your ridiculous
behavior likely won't help with them either.

Brian

--
If televison's a babysitter, the Internet is a drunk librarian who
won't shut up.
-- Dorothy Gambrell (http://catandgirl.com)
Apr 22 '06 #13

This discussion thread is closed

Replies have been disabled for this discussion.