Live data from Hacker News

Zed Shaw on C++

librelist.com

111–120 of 210 posts

Re: Zed Shaw on C++

#111

Earlier quoted context omitted.

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.

Say you need both modularity and low level access in a given program. Can they be so entangled that you absolutely have to put both in the same language?

No matter how I put it, I fail to see how C++ can be better than C + (Python or Lua or Haskell, with FFI). Is the concept of using 2 languages at the same time so scary?

Re: Zed Shaw on C++

#112
post #93

I don't get these rants. Both C and C++ are such barebone languages that you can take or leave pretty much everything but the common syntax. Zed decides C's string functions are not up to scratch, and so uses bstring. Plenty feel the same about std::string, and will use bstring's CBString, Qt's QString, or some other class in their C++ code. Exceptions? Take them or leave them. setjmp/longjmp? Take them or leave them…

The problem is, your co-workers will do the same with other features. Unless the project is under a strong dictatorship, you'll end up taking everything.

Re: Zed Shaw on C++

#113
post #67

Earlier quoted context omitted.

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 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.

Re: Zed Shaw on C++

#114
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.

http://www.swig.org/ automatically binds existing C++ software to other programming languages. I use it a lot to call C++ from Python and Java and I must say it is really amazing piece of software.

And there is also Boost.Python.

Re: Zed Shaw on C++

#116

Earlier quoted context omitted.

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.

Say you need both modularity and low level access in a given program. Can they be so entangled that you absolutely have to put both in the same language ? No matter how I put it, I fail to see how C++ can be better than C + (Python or Lua or Haskell, with FFI). Is the concept of using 2 languages at the same time so scary?

"Say you need both modularity and low level access in a given program. Can they be so entangled that you absolutely have to put both in the same language?"

That's not always an option if you've performance and memory constrains.

We're using Python only for high level scripting purposes.

If you've a performance critical function, where few data goes in, long computation and few data out, then it's perfect to implement this function in C and have a python function calling it.

But if you've a lot of data, then that's not an option. You just can't copy all the data to C and then after computation back to python, it will kill the performance gained by the C function implementation.

But also if you're trying to do complex operations on your application object hierarchy, Python will kill your performance. Only compare the time for a member/property access in Python and C++.

Re: Zed Shaw on C++

#117
post #82
post #14

Bunch of age-old banalities from a famous narcissist on top of front page.. Is there any HN 2.0?

2.0? You really trotted out that cliche? Ok, I'll one-up you: 2005 called, they want their joke back.

Thank you for your reply! We all know you're very productive writer. ^_^

Re: Zed Shaw on C++

#118
post #65

The real problem with C++ is that there isn't a fucking split function in the standard library.

I donate you one:

   #include 
   #include 
   #include 

   typedef std::vector Strings_t;
   Strings_t split(const std::string& string, char onChar)
   {
      Strings_t splitted;
      size_t lastSplit = 0;
      for (size_t i = 0; i 

Re: Zed Shaw on C++

#119
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.

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 fragmentation, and its still a problem.

Re: Zed Shaw on C++

#120
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?

C is still the foundation of C++. So programming in C++ made me respect C. And many great libraries are C (OpenGL, SQLite, zlib, etc.).

Programming in C++ made me realize how naive C is, in both good and bad.
Post reply on HN