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

M

mneuhaber22

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
 
B

Bit byte

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

davidrubin

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

Roland Pibinger

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
 
R

REH

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
 
M

mneuhaber22

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!
 
D

davidrubin

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

mneuhaber22

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

loufoque

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/docs/papers/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.
 
D

davidrubin

loufoque said:
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/docs/papers/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?
 
R

REH

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
 
R

REH

loufoque said:
(e-mail address removed) 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
 
D

Default User

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
 

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top