Live data from Hacker News

Zed Shaw on C++

librelist.com

121–130 of 210 posts

Re: Zed Shaw on C++

#121
post #40
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…

Alexandrescuisms has 2 hits on google including this page. To what are you referring?

His book "Modern C++ design" is about the fascinating beautiful and downright frightening things that you can do with C++ templates. It is worth a read.

However, to support what Zed is saying, Scott Myers (of Effective C++) was astonished about some of the things done there.

C++ doesn't follow the principle of Least Astonishment in any way that I can think of. And that is not good.

Re: Zed Shaw on C++

#122
post #113

Earlier quoted context omitted.

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

Perhaps you need to run deterministically without a stop-the-world garbage collector? A) the world is bigger than simple web applications and B) some of us have been doing this for a long time.

Can you give an example of stop-the-world garbage collection?

Re: Zed Shaw on C++

#124
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 is no other language for crafting large-scale, high performance tools is demonstrably false. There are high-volume low latency world-class financial systems written totally in Java.

The seriously complex and high-performance ITA system is written in Lisp.

And if you read Coders at Work, some of the criticisms of C++ suggest that the reason behind many of the C++ features is that Bjarne didn't want to say NO.

And I am happy to leave that particular niche of badness to C++ its own self.

Re: Zed Shaw on C++

#125
post #63

Earlier quoted context omitted.

gcc compiles Obj-C, but without some of the improvements apple has made. I personally wish Obj-C were more common because mindshare is a real issue.

Ironically, the whole iphone apps goldrush seems to have contributed in a big way to increase its mindshare. Obj-C is very beautifully designed, I especially like how it adds message passing OOP to C with very minimal syntax additions. But then calling objc_msgSend for every message send, does have a small performance penalty attached, which mostly static languages like C++ don't have to pay.

So does C++ have any price to pay for say vtables?

Re: Zed Shaw on C++

#126

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…

What do you think about D?

I have a lot of respect for Walter Bright as a programmer and language designer, but I am more likely to try Go.

Re: Zed Shaw on C++

#127
post #79

Earlier quoted context omitted.

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…

I've seen you talk about this on the Io list for a while now, but you never seemed to have posted a link to it. Glad I can finally take a look at it :)

Re: Zed Shaw on C++

#128
post #122
post #113

Earlier quoted context omitted.

Perhaps you need to run deterministically without a stop-the-world garbage collector? A) the world is bigger than simple web applications and B) some of us have been doing this for a long time.

Can you give an example of stop-the-world garbage collection?

Javascript... Yes, even V8.

Side rant: it's part of the reason that my Palm Pre will sometimes just hang for a second at the worst times, such as when I go to answer the phone. :(

Re: Zed Shaw on C++

#129
post #122
post #113

Earlier quoted context omitted.

Perhaps you need to run deterministically without a stop-the-world garbage collector? A) the world is bigger than simple web applications and B) some of us have been doing this for a long time.

Can you give an example of stop-the-world garbage collection?

A simple mark & sweep or stop & copy GC. Collectors which are incremental (work in small steps, not one full pass at a time) and/or generational (using several smaller generations, which are collected individually) break up GC pauses into something less disruptive.

For a good overview, read "Uniprocessor Garbage Collection Techniques" by Paul Wilson (check google scholar). Richard Jones's _Garbage Collection: Algorithms for Automatic Dynamic Memory Management_ is more in depth.

Re: Zed Shaw on C++

#130
post #113

Earlier quoted context omitted.

Perhaps you need to run deterministically without a stop-the-world garbage collector? A) the world is bigger than simple web applications and B) some of us have been doing this for a long time.

I wasn't talking about web applications, and modern garbage collectors are not stop-the-world. Not to mention ... stop-the-world garbage collectors have a good reason for doing what they do. They are defragmenting the memory. You get that for free, when in C++ you would have to deal with hell if your app is doing lots of allocations ... see the shit the Firefox devs had to go through to alleviate the problems of heap…

Ah, but what, you're using both managed code (C#) and unmanaged code (C++) in the same address space, doing memory intensive work using third party proprietary C++ code that does lots of small allocations?

In 32-bit land, it's welcome to OutOfMemoryException because managed code can't allocate a big enough chunk when returning to C#.

No free lunch :)

Either recycle processes often or reserve big enough contiguous chunks in managed code before calling out to the bad C++ code, no amount of good citizenship in managed code will stop the poorly written native code from fragmenting the hell out of your address space.

Post reply on HN