Log in

No account? Create an account
Adventures in Engineering
The wanderings of a modern ronin.

Ben Cantrick
  Date: 2007-09-06 13:01
  Subject:   C++ is not a very good language.
  Mood:holy wars
  Music:KMFDM - Power
  Tags:  reddit

"If you must use the wrong language for the job, I'd rather see you use C than C++. It's true that C gives you enough rope to hang yourself. But so does C++, and it also comes with a premade gallows and a book on knot tying." -Unknown Kuro5hin.org commenter, circa 2004

Or, you could ask Linus: http://thread.gmane.org/gmane.comp.version-control.git/57643/focus=57918

Not to say that C is perfect. Far from it. But for quite a while now, I've been telling people: "If you want to do OO stuff, just go straight to Java. If what you're doing needs higher performance, use plain C." It used to be that you could at least argue "well, I need reasonable performance, and I also need OO... so I have to use C++." With Java, that excuse is gone.

The only people who truly need to write in C++ any more are Win32 programmers. The poor, screwed-over bastards.

Edit: Or X11 programmers. Those even poorer, even more screwed-overer bastards.
Post A Comment | 8 Comments | | Flag | Link

Coinneach Fitzpatrick
  User: scarybaldguy
  Date: 2007-09-06 21:05 (UTC)
  Subject:   (no subject)
My first coding job was in Ada, the milspec version of C. I went home with a headache every gorram day.
Reply | Thread | Link

  User: ohmisunao
  Date: 2007-09-06 21:09 (UTC)
  Subject:   (no subject)
Game companies tend to use C++ as well.. may I have more rope? :)

What do you think of C#?
Reply | Thread | Link

Ben Cantrick
  User: mackys
  Date: 2007-09-06 23:39 (UTC)
  Subject:   (no subject)
Nowhere near enough experience with C# to judge. It seems good... but until I actually write a real program in it, I won't know.
Reply | Parent | Thread | Link

Trevor Stone: java logo
  User: flwyd
  Date: 2007-09-06 21:45 (UTC)
  Subject:   (no subject)
Keyword:java logo
I believe Google uses C++ for their main search code. (They also use Python when scripting is called for and Java for things like GMail and WebServices.) I suspect a significant reason for C++ in that role is that it can manage more RAM. Java (at least the 32-bit variety) is limited to about 2GB on Linux, 4GB on Solaris.

Java 6 made a lot of improvements in things like graphics pipelines, double buffering, and other GPU excitement. Prior to that, I can definitely see an argument for C++ in lots of graphics-heavy contexts. And if you've been doing graphics in C++ for the last ten years, even switching to a Java that's got all the performance you want is going to be somewhat painful.
Reply | Thread | Link

Ben Cantrick
  User: mackys
  Date: 2007-09-06 23:01 (UTC)
  Subject:   (no subject)
I think most of those arguments are really more arguments for C over Java, not C++ over Java. I do think there are times when you should use C instead of Java. I'm hard-pressed to think of more than a few little corner cases where you really need to use C++ instead of Java.
Reply | Parent | Thread | Link

  User: jigenm4c
  Date: 2007-09-08 07:02 (UTC)
  Subject:   (no subject)
My main arguments with Java come three fold:

- Java NIO doesn't support a Proactive stack (ie. offer data for read/write/connect/disconnect instead of a select loop REQUIREMENT. Most OSes can handle Proactive TCP-IP, Mac OS Included. I don't think Windows can, though.) But I'm waiting for Java NIO 2.
- Java I/O doesn't have raw packet support, so you can't write your own DHCP server, or perform packet rewriting (particularly helpful in passive proxy forwarding of TCP/IP packets.)
- Java doesn't have direct X Windows support, so you can't create your own true Java-controlled Widgets. They're getting close with the next release of Java, but it's not close enough.

For a while, now, I've wanted to create a transparent proxy server that runs with a server farm in the background that can have connections forwarded to it from a DMZ, routed passively to a 192.x.x.x address internally. Right now, it's done via software and caching. But that's an extra layer that I don't want to use. I know you can do it with iptables. But that's Linux and Mac OS. What about Windows?

Passive TCP/IP handling is getting there. Mina does a fine job at that, but it's not true passive TCP/IP. I want to have a function called when data comes in on a threaded basis; I don't want to have to create a fricking busy loop on a select to handle that. Those days are over, and with the advent of multicore programming becoming more and more a daily affair, it's important to get rid of it all together.

Java ... 10, maybe?
Reply | Thread | Link

  User: jigenm4c
  Date: 2007-09-08 07:05 (UTC)
  Subject:   (no subject)

JSR 203, Java NIO 2 is going to be released in Java 7, when it comes out.

I'm on the development team for Java 7's NIO 2, so I'll be looking over the API and making contributions to the code as I test it. Should be an interesting ride. Unfortunately, though, Doug Lea's not released the source code yet... *grumble*
Reply | Parent | Thread | Link

  User: triggur
  Date: 2007-09-09 20:11 (UTC)
  Subject:   (no subject)
I've always been vaguely horrified by C++ myself.

Of course, I experience the same horror when I meet a programmer who can't think in terms of linear, procedural code and absolutely must do everything as objecty as possible. It drives me absolutely mad seeing someone pump out a dozen or two tangled, factory-laden classes to do something the objecty way when a hundred or so lines of procedural code would suffice.
Reply | Thread | Link

May 2015