Messing with c++

I started to learn C++ after learning Java but all the different tutorials seemed to disagree with each other and it seemed to take so long to get anywhere. So I now i am learning python, which i find suites me more.

After coding few small programs I must say that it’s terrible to code C++. After I realized that how I must declare public and private methods I started to hate it. So much more writing to do some simple things. I am not going to write any games with it because java (and even python) is fast enough for small games.

I heard of that new improvement C++0x (name sounds like it’s even worse than previous). Does anyone know something good about it?

What’s better in D? Does it have those annoying pointers like in C and C++? Could D become as popular as C++ or Java?

Which is funny, because C++ programmers moving to Java often complain about how verbose Java is, in particular how it’s annoying to explicitly define everything as public or private instead of deliminated blocks.[1]

[quote]I heard of that new improvement C++0x (name sounds like it’s even worse than previous). Does anyone know something good about it?
[/quote]
C++0x is the placeholder name, it’ll become C++0xN depending on when it’s actually standardised, similar to how C99 was named (and is increasingly looking like it’ll be C++0xA since it’ll be at least 2010 before it gets finished). Personally I think it won’t be terribly important, since all they’re really doing is moving the common/important parts from Boost into the standard library. And they’ll still be maintaining (mostly) C compatibility which is the real weight around C++'s neck so they won’t be able to do anything major.

[quote]What’s better in D? Does it have those annoying pointers like in C and C++? Could D become as popular as C++ or Java?
[/quote]
Unlikely. It’s been going for many years now and doesn’t show any signs of significant progress. It started off as a good compromise between C++'s low level and Java’s high level, but has increasingly been side tracked by trying to introduce “trendy” new features with limited scope, making the same basic mistakes as C++ (but without the historical justification) and generally being clunkier and more inelegant than either Java or C++.

Personally I think C++ is a facinating language, and generally very, very good given the goals and compromises it set out to acheive. But if your compromises don’t match then it’s going to be a very poor fit for you.

[1] Right up until the point where you start including private: or public: expressions inside of macros. Then it all goes a little weird.

That’s so wrong :slight_smile: I know a lot of D users, myself included, who will strongly dispute that it’s clunkier or more inelegant that Java or C++. It’s miles, leagues, ahead of C++ in that regard.

I’ve been active in the D community since it was in early beta and it has made, and is still making, large strides. The pre 1.0 ramp up took a few years, as Walter (the sole developer at the time) took his time to get it right. D 1.0 wasn’t launched until Jan '07. Now, it’s perfectly stable and works as advertised (with a few minor quirks). D2 is under development and is where the major focus is now, with the 1.x series getting bug fixes and the occasional back ported feature. The D2 spec is expected to be finalized by the fall of this year. It’s a major shift in focus and will be unlike anything else out there. Multiprogramming is the future, so D is being positioned to meet the challenges that brings.

Take a gander at these slides from a recent presentation Andrei Alexandrescu gave at the ACCU conference (PDF): Grafting Functional Support on Top of an Imperative Language. Andrei is deeply involved in D2’s development. Those slides will give you an idea of where it’s going.

If D was were it is now when Java came out, it might have got some serious traction. As it is, it’s a decade too late. But… miles and miles better than C++.

I must admit that it’s annoying to write private before every variable.

I was just thinking that if I write as Javaish code as I can with C++ what would be the result (I mean what would be performance compared to Java? I mean if I would code with fully object oriented coding style and I wouldn’t use those pointers and other features that C++ has but Java doesn’t.

Your performance will probably be worse, since the C++ object model is more complex than the java model. Where C/C++ shines is the performance when doing number crunching of large sets of raw data.

It looks like I wasn’t thinking too much when I said that comment. Of course I can do like: private int x, y, z etc…