Live data from Hacker News

Zed Shaw on C++

librelist.com

51–60 of 210 posts

Re: Zed Shaw on C++

#51
post #11

Earlier quoted context omitted.

The best pro C++ argument is that for all its flaws there's nothing out there that completely replaces it and it's still widely used. My own view: I'm not in love with C++, but it's not nearly as bad as everyone makes it out to be. Most of the arguments I hear against C++ are the same tired things I've heard hundreds of times. They all have a grain of truth, but nothing so bad as to condemn the language.

It's not that any one thing is bad. It's that lots of things are bad.

Lots and lots of things are bad in C++. But that's because it's an elaborate language with lots of things in it. You only have to use one bad thing at a time ;-).

Basically, any language with lots of modularity and lots of low level access is going to be big and have lots of features that are problematic in some situations.

Re: Zed Shaw on C++

#52
post #11

Earlier quoted context omitted.

The best pro C++ argument is that for all its flaws there's nothing out there that completely replaces it and it's still widely used. My own view: I'm not in love with C++, but it's not nearly as bad as everyone makes it out to be. Most of the arguments I hear against C++ are the same tired things I've heard hundreds of times. They all have a grain of truth, but nothing so bad as to condemn the language.

My short rant: C++ is as bad as they say it is. It is horrible, it is the worst language in the world ... except for all the other (a la Winston Churchill and democracy). The horrifical complexifications of C++ are just terrible, yet every one of them has a reason behind it. And also, the horrifical complexities are a bit more optional than the horrifical complexities of, say, Java. There isn't another language that…

"There isn't another language that has both the large-scale modularization given by OO and low-level efficiency of direct pointer manipulation and other C features."

Objective C?

Re: Zed Shaw on C++

#53
post #4

There appear to be a lot of good rants against C++. To name a few: * Linus Torvalds : http://lwn.net/Articles/249460/ * C++ Frequently Questioned Answers : http://yosefk.com/c++fqa/ Are there any good passionate pro C++ versus C arguments?

Sure.

http://warp.povusers.org/grrr/HateC.html

http://warp.povusers.org/grrr/cplusplus_vs_c.html

The guy has some fun rants in general.

Edit: Oh yeah, and this one, responding to Linus' rant.

http://warp.povusers.org/OpenLetters/ResponseToTorvalds.html

Re: Zed Shaw on C++

#54
post #4

There appear to be a lot of good rants against C++. To name a few: * Linus Torvalds : http://lwn.net/Articles/249460/ * C++ Frequently Questioned Answers : http://yosefk.com/c++fqa/ Are there any good passionate pro C++ versus C arguments?

Fwiw, from the other day: http://tmsh.posterous.com/you-can-read-the-c0x-faq-in-an-hou...

Re: Zed Shaw on C++

#55

Earlier quoted context omitted.

"You'll find crap in C++ like const *const char &, and hell if anyone knows what that really means since even though the pointer to a const to a const reference is consted to hell and back, oh look you can still increment it." I'm still looking for the part where he doesn't understand how const _works_.

"const *const char &" is not valid C++ syntax, so I'm pretty sure you can't increment it. Therefore, anyone saying you can increment it doesn't understand it. QED.

There's this thing called a joke . . . I believe that's waht Zed is making here.

Re: Zed Shaw on C++

#56
post #15

Earlier quoted context omitted.

"There appear to be a lot of good rants against C++....Are there any good passionate pro C++ versus C arguments?" By definition, the people who write the "entertaining" rants against C++ have an axe to grind. The people who like C++ just silently use it , and feel no need to write advocacy blog posts for the language. Even if they were to blog about it, it would be about as compelling as someone advocating for their…

For some concrete examples of the above: WebKit, Chromium, Gecko, and V8 are all C++. My impression is that there is a very high startup cost with C++ to getting it working on the platforms you want to support and picking the subset that isn't going to screw you. Once you get over the hurdle, the improved memory management (I agree with the post Zed is ranting in response to) starts to pay dividends.

V8 is hardly a ringing endorsement for C++. Just sayin.

Re: Zed Shaw on C++

#57
post #33

I agree totally with Zed Shaw on this, but some quick observations: * C++ circa 2000 (before mainline g++ could handle Alexandrescuisms) is significantly different from C++ circa 2010, albeit in ways that probably upset Shaw even more (the more central role boost has taken, the more "expressive" templates have gotten, don't call me on any of this stuff). * C++ std::string is an abomination, but you can always just do…

The problem with std::string is that when I type a quoted string in my code, it isn't natively a std::string, it's natively a char* and gets converted to strings. C++'s biggest mistake was not standardizing early on an official object-oriented string datatype. It should have been in the first version of C++, it should have been treated like a primitive type (even if it isn't), and they should have said "thou shalt us…

The great thing about const is that if you don't like it you can pretty much ignore it. The only time it might be necessary to deal with it is if you are using a library that returns const objects.

If you do like const (which I do) then you can put it in pretty much everywhere, except if you are dealing with a library that isn't "const correct", but then a bit of type casting will save the day.

That's a big advantage of lots of the C++ features - if you don't like them you can often just ignore them.

Re: Zed Shaw on C++

#58
post #52

Earlier quoted context omitted.

My short rant: C++ is as bad as they say it is. It is horrible, it is the worst language in the world ... except for all the other (a la Winston Churchill and democracy). The horrifical complexifications of C++ are just terrible, yet every one of them has a reason behind it. And also, the horrifical complexities are a bit more optional than the horrifical complexities of, say, Java. There isn't another language that…

"There isn't another language that has both the large-scale modularization given by OO and low-level efficiency of direct pointer manipulation and other C features." Objective C?

Arguably this might be true, however if you add another requirement to the list Joe posted it isn't. Cross platform code is important to many people. I work on large scale, performance intensive, cross platform applications. Microsoft tells me I should be doing everything in C#. Apple tells me I should be doing everything in Objective C. I just get on with it and use something that works. A language that gives me the ability to combine high level design with low level efficiency and run on multiple platforms.

I often use a paraphrase of the Winston Churchill quote as well. There are probably many better languages for many other applications, however for high performance, cross platform large scale apps C++ is still the only game in town.

Joe's point that all the complexities have reasons behind them is a really good one. I'd suggest reading Stroustrup's "The Design and Evolution of C++" for more information.

Re: Zed Shaw on C++

#59
Call me unlucky, but I've never worked at a company that had a high percentage of programmers (myself probably included) that could write solid C++ using anything more than the absolute basics, i.e. basically a C subset.

I'd pretty much agree with Zed's rant, that C++ often isn't worth the bother, unless you have a project that specifically requires C++ features, and you have a development team that can actually write solid C++.

Maybe I'll call this Jonathan's axiom, but if your team doesn't have enough experience to write in a Lisp-y (or any other genre such as ML-y) language, you probably shouldn't be messing with C++ either.

Not many people that say they can write C++, actually can.

Re: Zed Shaw on C++

#60
post #57

Earlier quoted context omitted.

The problem with std::string is that when I type a quoted string in my code, it isn't natively a std::string, it's natively a char* and gets converted to strings. C++'s biggest mistake was not standardizing early on an official object-oriented string datatype. It should have been in the first version of C++, it should have been treated like a primitive type (even if it isn't), and they should have said "thou shalt us…

The great thing about const is that if you don't like it you can pretty much ignore it. The only time it might be necessary to deal with it is if you are using a library that returns const objects. If you do like const (which I do) then you can put it in pretty much everywhere, except if you are dealing with a library that isn't "const correct", but then a bit of type casting will save the day. That's a big advantage…

That's usually considered a drawback of C++; it's a huge, complicated language and everybody tends to use a different subset for their own work.
Post reply on HN