473,378 Members | 1,393 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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

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
12 2744


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

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

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

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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tony | last post by:
Hello. What is hash table? i could only find small reffrence to hash table .. but what exactly is this and how can i creat them? Is there any website with tutorial on this subject ? Thanks
4
by: Pelo GANDO | last post by:
Hi everybody ! I am a beginner in C++. I am looking for a (simple if it's possible) source code in C++ about hash table... Thank you ! Pelo
14
by: Alex Vinokur | last post by:
Here is some function that detects if a vector contains only different elements bool vector_contains_only_different_elements (const vector<int>& v) { for (int i = 0; i < v.size(); i++) { if...
16
by: Kitty | last post by:
Hi, everyone. Given a vector<int>, what is the fastest way to find out whether there is a repeated element in it? The result is just "true" or "false". Thanks. Kitty
13
by: Ben | last post by:
I have a program which is using a lot of memory. At the moment I store a lot of pointers to objects in std::vector. (millions of them) I have three questions: 1) Lets say the average Vector...
7
by: Zhiqiang Ye | last post by:
Hi,dear all, I know there is a hash library in glibc, it's head file is search.h. One can use hash map based on this.But its hash is global , there could be only one hash structrue at one time. Is...
2
by: Markus Dehmann | last post by:
Hi, I'd like to hash std::vector<intobjects using hash_set, but I'm not sure what hash function to use. Does anybody have a suggestion? Thank you! Markus
16
by: xyz | last post by:
I have to run the simulation of a trace file around (7gb contains 116million entries)... presently i am using vector iterators to check the conditions in my program..... it is taking 2 days to...
23
by: raylopez99 | last post by:
A quick sanity check, and I think I am correct, but just to make sure: if you have a bunch of objects that are very much like one another you can uniquely track them simply by using an ArrayList...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.