C++ sucks
Peter Korsten
EMAIL HIDDEN
Thu Nov 22 19:15:30 CET 2007
Jay Vaughan schreef:
> short the_byte;
> long the_int;
Yes, but here comes the next problem: speed. With C, specifically on
Unix, I can mmap() a file and it magically appears as a bit of memory,
without any effort from my side. Since you need to be jumping through
that memory, you'll be looking at pointers - a concept that Java lacks.
So I'd be looking at C, or C++.
> any reason you don't have a dynamic data structure lib for C by now?
> just asking ..
Yes, two reasons really. One, I'm the only one doing C, and only very
occasionally. So developing a reusable library is only going to pay off
for my own C projects, which are few and far between. Two, most of the
stuff we do concerns databases, sometimes text files, web applications
and web services, and Java is a natural choice for those, because
abstraction of databases and easy to use network connections come
standard. There's just a huge amount of libraries for Java, which makes
it hard to beat for many tasks.
> My "C++ Primer", 5th edition, says that C++ has interfaces, but maybe
> your c++ compiler doesn't.
But not in a way to *completely* separate interface and implementation.
In Java, you can make an API that consists just of interfaces and
abstract classes, and leave the implementation up to someone else.
In C++, you can't have an abstract base class (which for me means
without any private members), implement it in another class, and use
that implementation whilst pretending it's still the interface. In Java,
you can stick that interface in a template class, but my Sun Studio 11
compiler started complaining that it couldn't instantiate a
vector<PetersClass> because PetersClass was abstract.
> you're gonna be a terrible mule driver if you give up after one day
> in an alley with no serious load in the cart ..
No, it's a repeat of a previous experience, where I was struggling for
months with C++, but now with the added experience of how to better
design an object-oriented language.
> i love me my current C++ project, but i must concur that i've
> considered going plain ol' object-oriented C for the next bit ..
I find myself reasonably easily slipping back into my old C routine.
Java also is easy to do. But C++... it's just a very inelegant
collection of poor design choices.
- Peter
More information about the music-bar
mailing list