Live data from Hacker News

Zed Shaw on C++

librelist.com

101–110 of 210 posts

Re: Zed Shaw on C++

#101
That was rather bogus. Sure, destructors are horribly complex in their interaction with all of the other horribly complex C++ features. But unless I'm reading it wrong, Aughey wasn't suggesting using all those other features.

If you have some reasonable self-control, it is quite reasonable to use C++ as a small superset of C.

Re: Zed Shaw on C++

#102
Just using constructors/destructors and class encapsulation makes code so much more readable.

And most exception problems are solved with RAII. If you're using RAII, then you won't have memory leaks when exceptions arise.

Re: Zed Shaw on C++

#103
post #79
post #16

Exceptionally good critique. But there are exceptions: programming for Google's V8 in C++ is a pleasure. I've never seen any interpreter code so clean and easy to extend. Like a breath of fresh air.

Embed V8 into Python, then tell me how great C++ is. In other words, C++ is great until something else has to call it. Then you're hosed and end up wrapping everything in C anyway.

That's what I've written a library to fix - it makes it quick and easy to bind C++ api's to make them callable from a dynamic language. Not only can you bind a C++ function with 1 line of code, but if that function returns an object, the returned object's member functions are callable on its scripted instance:

http://github.com/dennisferron/LikeMagic

Currently there is only an Io backend, but the library is designed so that the same C++ bindings can be used with multiple different backend languages. It's like Boost::Python on steroids.

Re: Zed Shaw on C++

#104
post #100
post #16

Exceptionally good critique. But there are exceptions: programming for Google's V8 in C++ is a pleasure. I've never seen any interpreter code so clean and easy to extend. Like a breath of fresh air.

No, it's not an "Exceptionally good critique." It's not exceptional, it's not good and it's not a critique. It's not exceptional because nothing of the points he raises are anything but a re-re-rehash of the same old tiring arguments that have been raised against C++ for 15 years or more. It's not good because the examples he makes are straight up wrong or so vague as to be useless. His 'const' example is jibberish a…

You're right. But I can only offer you an up-vote.

Re: Zed Shaw on C++

#106
post #97

The problem with const string& is that the resulting string is not interned - e.g. one copy in memory, which would later allow to save memory, compare by pointer equality (eq), etc. I understand that the language cannot express it, and that's why other languages (such as lua) do it the right way - immutable strings all the way, or at least by default (NSString)

You can make a string class that interns strings. Language can express it, but std::string doesn't do it.

Re: Zed Shaw on C++

#108
post #67
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…

The people who like C++ just silently use it Indeed. At my last job, working on trading software, we had around 35 maths or physics PhDs working on a C++ application. A few had personal blogs (cats, children, steam engines, etc) but as far as I am aware no-one there argued on the Internet about which language was best. C++ just doesn't attract self-publicists the way Ruby seems to.

> C++ just doesn't attract self-publicists the way Ruby seems to.

That's a cheap shot ... Linus Tolvards is definitely not the Ruby-type.

And his arguments are sound ... for system programming, C is a much better language because it's simpler, lacks magic, making the pieces of code easier to understand without the bigger context, and it's more portable.

And for application-level programming, why would you chose a language without a garbage-collector?

Re: Zed Shaw on C++

#109
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…

That would have required a decision, and if there's something committees are uniquely unqualified to make, it's decisions.

The fact that it's C++, where the prototypical user believes that they shouldn't pay for what they don't use just makes things worse. Everything being optional means there can be very few synergies in language or standard library design, because if feature A needs feature B to work, people who want A but not B will complain. C++ "chooses" either by omitting both A and B, or creating some low-level error-prone features and hoping users won't chop off too many fingers trying to build their own incompatible versions of A and B. An ill-designed misfit language is all but required by the dynamics of the situation.

Re: Zed Shaw on C++

#110
post #44

Earlier quoted context omitted.

After getting use to the STL containers... I could never go back to pure C. I use C++ daily and love it. Nothing against C (if that's what you like) it's a great little language. Why is it that C programmers bitch about C++, but C++ programmers don't bitch about C?

Because we're having too much fun writing cool things in C++ to bother to write rants.

Because you're too busy waiting for all that C++ code to compile before you can be too busy debugging it ..

FtFT! :)

Post reply on HN