[linux-elitists] The PDP-11 assembler that thinks it's an object system!
Tue Mar 25 19:22:15 PST 2003
begin Ben Woodard quotation:
> Disclaimer, I've been a nominal C++ advocate since 1989 when I first
> used Cfront 1.1. Just after it changed its name from C with classes to
I have a first edition trade of Stroustrup. The language was
once very clean and simple. It provided basic class management and
encapsulation sugar, and didn't try too hard to become CLOS or
> You don't have to use every feature. The worst C++ programs that
> I've ever seen were those where you could tell that the author had
> just read a book on C++ and had all the features fresh in their mind
> and tried to use them all in their program.
And yet sometimes we actually need to be able to manipulate
heterogeneous lists, and want it to JUST WORK.
> In a lot of ways, I think that the free software world would be a
> better place if everyone switched to C++ or at least glib. There are
> so many hand written implementations of linked lists, hashes, sets
> etc... and many of them are subtly broken or poorly optimized. If
> people would use good well written libraries rather than rolling
> their own fundemamental data structures I think free software would
> improve considerably.
This is true. glib has a lot of good stuff in it. It also
hapens to be soaking up the GTK+ object system, which is adding some
ridiculous type checking code. But I do agree that glib goes further
toward taking the stink out of C than any other attempts I've seen.
> It is almost true that anything that you can do in C++ you can also
> do in C (exception handling may be the exception) and that C++ just
> puts semantic sugar on it.
You could handle exceptions using macros and global state
pretty simply. Your THROW macro would set a semaphore and return, and
your CATCH macro would check for the appropriate global state and play
with case-and-return logic.
I love how C case statements made GOTO stylish again.
> > My question is -- now that we have GCC 3.2.x
> > (http://gcc.gnu.org/gcc-3.2/ -- "A primary objective was to
> > stabilize the C++ ABI; we believe that the interface to the
> > compiler and the C++ standard library are now relatively stable.")
> > and an increasing collection of interesting free software using
> > C++, is it time to take a second look at this perhaps unfairly
> > maligned language?
> I'd say "yes". I think C++ is a more expressive language and can
> provide programmers more leverage in working on big problems than C
The real argument, though, is not C++ vs C. The fact that C++
is (for the most part) a *superset* of C makes that discussion
The real argument is whether C++ really fills a need when you
have C on the "macro assembler to get performance" side and
Perl/Python/LISP/shellscripting on the "expressive language to get
work done" side. Surely the range where such a drastic compromise
between the two is needed is rather small, no?
More information about the linux-elitists